question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tizen: Playback won't start after application is hidden during playback

See original GitHub issue

We have an issue on certain Tizen devices (verified on 2018, 2019 & 2020 models). 2017, 2021 & 2022 models were also tested, but the behaviour differs. The latter don’t have issues when the application is restored.

Tizen devices support this Multitasking feature, which allows to store the application state when switching to another application. Whenever the application is reopened, this state should be restored. What we’ve implemented, is that we stop the player when the application is hidden (using player.stop()) and whenever the application is restored, we try to resume playback using player.loadVideo().

I’ve collected some logs when setting RxPlayer.LogLevel = "DEBUG" and gathered some relevant data:

Start playback using loadVideo

player.loadVideo({
    transport: "dash",
    url: "https://{redacted}GlobalManifest.mpd",
    keySystems: [{
        type: "widevine",
        ...
    }],
    autoPlay: true,
    enableFastSwitching: false,
    onCodecSwitch: "reload",
    textTrackMode: "html",
    textTrackElement: document.createElement("div"),
});

Logged data with API prefix:

Calling loadvideo https://{redacted}GlobalManifest.mpd dash
API: playerStateChange event LOADING
API: DRM session cleaned-up with success!
API: current playback timeline: timeupdate
API: current playback timeline: loadedmetadata
API: current playback timeline: seeking
API: current playback timeline: play
API: current playback timeline: ratechange
API: current playback timeline: seeked
API: current playback timeline: canplay
API: playerStateChange event LOADED
API: playerStateChange event PLAYING
API: current playback timeline: ratechange
API: current playback timeline: timeupdate

Then, we switch to another application, which fires this visibilitychange event. In the handler, we stop playback using player.stop():

player.stop();

After this call, 2 more logs will be visible:

API: playerStateChange event STOPPED
API: DRM session cleaned-up with success!

After a short period (10 - 20 seconds), we switch back to our app & again, the visibilitychange event fires, but this time we try to resume playback using player.loadVideo():

player.loadVideo({
    transport: "dash",
    url: "https://{redacted}GlobalManifest.mpd",
    keySystems: [{
        type: "widevine",
        ...
    }],
    autoPlay: true,
    enableFastSwitching: false,
    onCodecSwitch: "reload",
    textTrackMode: "html",
    textTrackElement: document.createElement("div"),
});

Again the logs with API prefix have been collected:

Calling loadvideo https://{redacted}GlobalManifest.mpd dash
API: playerStateChange event LOADING
API: DRM session cleaned-up with success!
API: current playback timeline: timeupdate
API: current playback timeline: loadedmetadata
API: current playback timeline: seeking
API: current playback timeline: ratechange
API: current playback timeline: timeupdate
API: current playback timeline: seeked
API: current playback timeline: canplay
API: current playback timeline: ratechange
API: current playback timeline: timeupdate

The player doesn’t seem to get into next state, as it stays in LOADING state, and keeps firing timeupdate events

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
peijkelhardtcommented, Dec 1, 2022

Yes, that might be the best option right now.

I’ve tested it, by disposing the player first (calling player.dispose()), and creating a new instance of the player (together with a new video element).

After all this, playback starts as expected 😄

So this may be a browser/Tizen issue instead I guess.

Anyway, thanks for your help & feedback

0reactions
peaBerberiancommented, Dec 1, 2022

OK interesting. Changing the media element this way may be risky because an RxPlayer considers that it is always linked to the same media element. Maybe the proper way would be to re-create a new RxPlayer associated to a separate media element.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multimedia DRM Q&A - Samsung Developers
How can I fix this? When the application is hidden, the DRM session can be removed. To avoid the "PLAYER_ERROR_NONE" error when the...
Read more >
Page Visibility - Tizen Docs
If the video page becomes hidden with a tab screen transition, the playback is paused. When the video page is visible again, the...
Read more >
Application Controls | Tizen Docs
This mechanism allows you to conveniently launch other applications whose functionalities you need in your application. If you need to use functionality ...
Read more >
Web Runtime - Application - Tizen Docs
It fetches the Web application name and icon from the application package using the rules defined in the Widget Packaging and XML Configuration...
Read more >
HTML5 video and audio element - Tizen Docs
You can use the HTML5 audio and video elements to play multimedia files streaming, without a separate plug-in. Using JavaScript, the playback can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found