移动浏览器上的HTML5视频自动播放 [英] HTML5 Video autoplay on Mobile Browser

查看:964
本文介绍了移动浏览器上的HTML5视频自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下HTML5和JQuery代码播放URL数组为URLArray []的视频播放列表。

  function NextFrag(){

if(index< URLArray.length)
{
$(#VideoContainer)。html('< video id = video1控制自动播放宽度=95%>< source src ='+ URLArray [index] +'type =video / mp4>< / source>< / video>');
index ++;
$(#video1)。bind(ended,NextFrag);
}
}

由于我们知道所有手机都禁用了HTML5的自动播放功能,因此我必须在手机上手动播放每个视频剪辑。我真的很想知道这个替代方案,我真的很感兴趣的代码段,我可以包括自动播放,而不涉及用户互动。



是否有可能将其转换为Android应用程序才能正常工作。我真的需要制作它像一个播放列表一样工作,我不担心如何,我只需要这个功能。



请帮助。

https://webkit.org/blog/6784/new-video-policies-for-ios/

Android 53上的Chrome 53还允许静音视频自动播放: https://developers.google .com / web / updates / 2016/07 /自动播放


I am using the following HTML5 and JQuery code to play a playlist of videos whose URLs are in an array URLArray[].

function NextFrag(){

 if (index < URLArray.length)
 {
   $("#VideoContainer").html('<video  id="video1" controls autoplay width="95%"> "<source src= "'+ URLArray[index]+ '" type="video/mp4"></source> </video>' );
   index++;
   $("#video1").bind( "ended", NextFrag);
 }
}

As we know that the autoplay feature of HTML5 is disabled in all mobile phones, as a result I have to play manually each video clip on mobile phone. which is definitely what I do not want.

I really want to know the alternative to this. I am really interested in code segment that I can include to make like autoplay without involving user to interact.

Is it possible to convert this to an android app to work. I am really in need to make it work like a play list, and I have no concern about how, I just need this functionality.

Please help.

解决方案

Since the release of iOS 10 Apple has allowed muted video autoplay: https://webkit.org/blog/6784/new-video-policies-for-ios/

Chrome 53 on Android also allowing muted video autoplay: https://developers.google.com/web/updates/2016/07/autoplay

这篇关于移动浏览器上的HTML5视频自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆