I'm developing an HTML5 application (a game), that automatically preloads 5 video files. I'm able to do so correctly on Safari for PC, so there are no overlooked problems with file formats, codecs or such. The load fails on an iPad. As an official guide for video on iOS puts it:
我正在开发一个HTML5应用程序(游戏),它会自动预加载5个视频文件。我能够在Safari for PC上正确地执行此操作,因此文件格式,编解码器等没有被忽视的问题。 iPad上的加载失败。作为iOS视频的官方指南,它说:
This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not.
这意味着JavaScript play()和load()方法在用户启动回放之前也处于非活动状态,除非用户操作触发play()或load()方法。换句话说,用户启动的播放按钮可以工作,但onLoad =“play()”事件不起作用。
Does this mean, that I have no means to initiate the loading of video after a user initiated action, if that action hasn't been tied to a video
element (user clicked on a regular div — I request loading and displaying of a video, compared to the user actually clicking on a video
element to load and play that particular element)?
这是否意味着,我无法在用户启动操作后启动视频加载,如果该操作未绑定到视频元素(用户点击常规div - 请求加载和显示视频,与实际点击视频元素以加载和播放该特定元素的用户相比)?
Thanks for your help!
谢谢你的帮助!
2 个解决方案
#1
0
It means that if a user has not pressed play, you can't use the methods.
这意味着如果用户没有按下播放,则无法使用这些方法。
#2
0
After further inspection, it turns out, that video.load()
and video.play()
methods can be called from any onClick
handler for any <div>
element (that probably stays true throughout every html element, that can receive click events.
经过进一步检查后,事实证明,可以从任何
The problem with preloading 5 video files on iPad is that it can only preload 1 and will flush any video data, if new video.load()
request for a different video is issued, thus you cannot preload 5 videos, but you can make them into single one and then preload that single video.
在iPad上预加载5个视频文件的问题是它只能预加载1并将刷新任何视频数据,如果新的video.load()请求发出不同的视频,那么你不能预加载5个视频,但你可以制作它们单个视频,然后预加载单个视频。
#1
0
It means that if a user has not pressed play, you can't use the methods.
这意味着如果用户没有按下播放,则无法使用这些方法。
#2
0
After further inspection, it turns out, that video.load()
and video.play()
methods can be called from any onClick
handler for any <div>
element (that probably stays true throughout every html element, that can receive click events.
经过进一步检查后,事实证明,可以从任何
The problem with preloading 5 video files on iPad is that it can only preload 1 and will flush any video data, if new video.load()
request for a different video is issued, thus you cannot preload 5 videos, but you can make them into single one and then preload that single video.
在iPad上预加载5个视频文件的问题是它只能预加载1并将刷新任何视频数据,如果新的video.load()请求发出不同的视频,那么你不能预加载5个视频,但你可以制作它们单个视频,然后预加载单个视频。