Bug 163570

Summary: Last player wins when multiple video elements have 'autoplay', 'muted' and 'playsinline' attributes set
Product: WebKit Reporter: Evol Greaves <evol>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Blocker CC: eric.carlson, jeremyj-wk, jer.noble, joao.machado
Priority: P2    
Version: Safari 10   
Hardware: iPhone / iPad   
OS: iOS 10   

Description Evol Greaves 2016-10-17 16:27:05 PDT
There are a couple scenarios that I'm seeking clarification on as to whether they are bugs or are working as intended.

Test page: http://demo.jwplayer.com/browser-examples/safari-autoplay.html

On an iPhone with multiple videos on the page:

1. In portrait mode, where there are multiple videos in the viewport, the last video to load is the one that starts playing.
2. In landscape mode, the behavior is as expected with videos playing/pausing as they enter/exit the viewport. However, I'm curious if videos above the fold should resume playback when you scroll up to bring them back into view. According to the documentation: "<video autoplay> elements will pause if they become non-visible, such as by being scrolled out of the viewport." But this does not speak to the use case of resuming playback of a video if it becomes visible again. 

Getting the above 2 scenarios resolved would be a huge win for us at JW Player.

Thanks,
Evol
Comment 1 Jer Noble 2016-10-17 21:15:59 PDT
(In reply to comment #0)
> There are a couple scenarios that I'm seeking clarification on as to whether
> they are bugs or are working as intended.
> 
> Test page: http://demo.jwplayer.com/browser-examples/safari-autoplay.html
> 
> On an iPhone with multiple videos on the page:
> 
> 1. In portrait mode, where there are multiple videos in the viewport, the
> last video to load is the one that starts playing.

This is a result of bug #162366.

> 2. In landscape mode, the behavior is as expected with videos
> playing/pausing as they enter/exit the viewport. However, I'm curious if
> videos above the fold should resume playback when you scroll up to bring
> them back into view. According to the documentation: "<video autoplay>
> elements will pause if they become non-visible, such as by being scrolled
> out of the viewport." But this does not speak to the use case of resuming
> playback of a video if it becomes visible again. 

They should, though this behavior might intersect with the bug above.

> Getting the above 2 scenarios resolved would be a huge win for us at JW
> Player.
> 
> Thanks,
> Evol
Comment 2 Evol Greaves 2016-10-17 22:06:05 PDT
Hi Jer,

Thanks for taking a look at this.

Would the ideal solution be allowing playback of multiple videos with added support for the IntersectionObserver API, making it possible for players to autoplay all videos or just the one that has the greatest intersection with the viewport?
Comment 3 Jer Noble 2016-10-19 10:12:30 PDT
(In reply to comment #2)
> Hi Jer,
> 
> Thanks for taking a look at this.
> 
> Would the ideal solution be allowing playback of multiple videos with added
> support for the IntersectionObserver API, making it possible for players to
> autoplay all videos or just the one that has the greatest intersection with
> the viewport?

That would allow the page to control autoplaying-only-when-visible manually, which I'm sure many page authors are interested in.  But the baseline behavior (<video autoplay> should play when visible) should "just work" once the related "multiple autoplaying videos" bug is fixed.
Comment 4 Evol Greaves 2016-10-19 11:24:42 PDT
Agreed. 

Is there a timeline set for a fix that we can share with our publishers?