android – 可以在iOS设备上强制HTML5视频预加载吗?

我发现有很多网站和参考资料证实,在Android和iOS移动设备上,HTML5视频preload =’auto’标签被故意忽略,浏览器等待用户手动按下播放按钮.

有没有办法可以推翻这种行为?

我们的情况是,我们计划让iPad在封闭的内联网WiFi系统上运行,其中蜂窝网络数据收费肯定不会成为问题.我们有视频文件,一旦页面加载,需要自动跳转到特定的播放位置.它在Windows,Linux或MacOS上的Chrome上运行得非常出色,但iOS却没有.

iOS或Android中是否有允许“预加载”的设置,就像在其他平台上一样?

或者,我已经在页面上进行了JavaScript和jQuery.是否有任何调用可以说服浏览器预加载视频,即使preload =’auto’没有?

我在http://www.stuartbruce.co.uk/editreader/javascript_video_test上放了一个测试页面来说明会发生什么.在Chrome上,在除iOS之外的所有平台上,视频会自动跳到镜头3.在iOS上,没有任何反应.

Apple关于这个问题的专线在这里:
User Control of Downloads Over Cellular Networks
但他们称之为“用户控制下载”这一事实意味着这是用户可以选择改变的.但是,我看不到任何证据.可能吗?用户或iPad可以“选择加入”以允许preload =’auto’正常工作吗?

解决方法:

根据下面的更新/信息,如果您设置了静音属性,则应该可以执行此操作:

video.play();
video.addEventListener('canplay', function() {
    this.currentTime = 5;
});

New Policies for iOS文章表明:

By default, WebKit will have the following policies:

  • elements will now honor the autoplay attribute, for elements which meet the following conditions:
    • elements will be allowed to autoplay without a user gesture if their source media contains no audio tracks.
    • elements will also be allowed to autoplay without a user gesture.
    • If a element gains an audio track or becomes un-muted without a user gesture, playback will pause.
    • elements will only begin playing when visible on-screen such as when they are scrolled into the viewport, made
      visible through CSS, and inserted into the DOM.
    • elements will pause if they become non-visible, such as by being scrolled out of the viewport.
  • elements will now honor the play() method, for elements which meet the following conditions:
    • elements will be allowed to play() without a user gesture if their source media contains no audio tracks, or if their muted
      property is set to true.
    • If a element gains an audio track or becomes un-muted without a user gesture, playback will pause. elements will be
      allowed to play() when not visible on-screen or when out of the
      viewport.
    • video.play() will return a Promise, which will be rejected if any of these conditions are not met.
    • On iPhone, elements will now be allowed to play inline, and will not automatically enter fullscreen mode when
      playback begins.
    • elements without playsinline attributes will continue to require fullscreen mode for playback on iPhone.
    • When exiting fullscreen with a pinch gesture, elements without playsinline will continue to play inline.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...