iOS - html5 - fullscreen mode - disabling scrubbing
I have a ht开发者_Python百科ml5 videoplayer with custom controls that I show/hide as needed. The default controls are removed via video.removeAttribute("controls").
However, when the user launches fullscreen, he gets the default iOS controls and can scrub through ads.
Is there a way of disabling seeking in fullscreen mode?
Thanks.
According to Apple, in fullscreen mode, they will always provide video controls:
http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
You could always disable fullscreen on iPad for the ad (removing the fullscreen control), then move back to fullscreen for the content. Not optimal, and won't work on iPhone/iPod Touch.
There is no way to directly prevent user from scrubbing in full screen mode in iOS, but there is a workaround which roughly work as below
- keep tracking of the playhead by subscribing timeupdate event
- subscribe seeked event, which will be fired when user scrubbing ends
- when receive seeked event, change videoEl.currenttime to last known playhead
To make it really work, there are some more details you need to work out. For example, when you change the currenttime, it will also trigger a seeked event. Therefore the step 3 should distinguish between seeked triggered by user scrubbing or yourself.
As of July 2016, the IMA3 SDK implemented something similar. You can try their demo at http://googleads.github.io/googleads-ima-html5/simple/
精彩评论