Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Android Chrome: engine switch in playlists does not work #50

Open
phloxic opened this issue Oct 19, 2016 · 6 comments
Open

Android Chrome: engine switch in playlists does not work #50

phloxic opened this issue Oct 19, 2016 · 6 comments
Assignees

Comments

@phloxic
Copy link
Contributor

phloxic commented Oct 19, 2016

EDIT: a switch from html5 engine to the hlsjs engine hangs up the player.
EDIT: only a problem with Android Chrome because, contrary to Android Firefox, it needs this nudge with autoplay: https://github.com/flowplayer/flowplayer-hlsjs/blob/master/flowplayer.hlsjs.js#L855-L867 - @nnarhinen
Among other things the additional play() call on Android comes probably to early.

Note that clicking on prev/next or a playlist item works (user interaction).

@phloxic phloxic added the bug label Oct 19, 2016
@phloxic phloxic self-assigned this Oct 19, 2016
@phloxic phloxic changed the title Android: live stream not playing as 2nd item of a playlist Android: engine switch in playlists does not work Oct 19, 2016
@phloxic
Copy link
Contributor Author

phloxic commented Oct 20, 2016

@phloxic
Copy link
Contributor Author

phloxic commented Oct 20, 2016

@nnarhinen - probably need some help with this.
The replacing of the video tag makes Android arguably correctly believe that play() is not triggered after user interaction. Ideas welcome.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 21, 2016

Something like this is needed in core to avoid the core error, and delegate the problem to the engine in charge:

diff --git a/lib/ext/mobile.js b/lib/ext/mobile.js
index 67af91f..c1ab91c 100644
--- a/lib/ext/mobile.js
+++ b/lib/ext/mobile.js
@@ -108,10 +108,12 @@ if (flowplayer.support.touch || isIeMobile) {
       if (isAndroid || isSilk) player.bind("ready", function() {

          var video = common.find('video.fp-engine', root)[0];
-         bean.one(video, 'canplay', function() {
-            video.play();
-         });
-         video.play();
+         if (player.engine.engineName === 'html5') {
+             bean.one(video, 'canplay', function() {
+                video.play();
+             });
+             video.play();
+         }

          player.bind("progress.dur", function() {

But indeed it literally only delegates the problem, because the hlsjs engine deals with a freshly created video tag, and is not allowed to call play().
It would most likely require only one play() call, and not even as late as ready, rather in load, but the device demands user interaction.

@nnarhinen
Copy link
Contributor

I'll try to address this in FP 7.0. Something to re-use the HTML tag for touch devices.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 21, 2016

Yes. Let's hope registering the engine events doesn't have a similar effect.

@phloxic
Copy link
Contributor Author

phloxic commented Feb 28, 2017

@nnarhinen - this is still an issue.
Note that already calling player.resume() here instead of videoTag.play() here: https://github.com/flowplayer/flowplayer-hlsjs/blob/master/flowplayer.hlsjs.js#L789 would prevent the plugin from working on Android altogether! videoTag.play() just about gets the foot in the door so to speak. But once an engine switch is involved the party is over.
The dashjs plugin has exactly the same problem of course.

@phloxic phloxic changed the title Android: engine switch in playlists does not work Android Chrome: engine switch in playlists does not work Jul 25, 2017
phloxic added a commit to flowplayer/flowplayer that referenced this issue Sep 2, 2017
This way it plays at least WebM and MP4 VOD - no HLS support at all
because MediaSource extension not present.

Furthermore we are using video.play() instead of api.resume() in all
these initial nudge scenarios. This decreases the chances of missing
user interaction errors, see
flowplayer/flowplayer-hlsjs#50 (comment)

In the same vein prefer video.load() over video.play() to trigger the
canplay hack.
phloxic added a commit to flowplayer/flowplayer that referenced this issue Sep 3, 2017
This way it plays at least WebM and MP4 VOD - no HLS support at all
because MediaSource extension not present.

Furthermore we are using video.play() instead of api.resume() in all
these initial nudge scenarios. This decreases the chances of missing
user interaction errors, see
flowplayer/flowplayer-hlsjs#50 (comment)

In the same vein prefer video.load() over video.play() to trigger the
canplay hack.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants