Open phloxic opened 7 years ago
@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.
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.
I'll try to address this in FP 7.0. Something to re-use the HTML tag for touch devices.
Yes. Let's hope registering the engine events doesn't have a similar effect.
@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.
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).