WICG / audio-focus

Other
21 stars 11 forks source link

"content" video without an audio track #19

Open xxyzzzq opened 7 years ago

xxyzzzq commented 7 years ago

From @jakearchibald on July 1, 2015 9:30

Do we do anything special with a <video> without an audio track?

Use case:

As a developer of an user-submitted video site, I want the videos to capture media focus if they have an audio track, but not if they don't.

Copied from original issue: WICG/mediasession#87

xxyzzzq commented 7 years ago

From @jakearchibald on July 1, 2015 10:57

I guess the best solution is to allow a developer to iterate over tracks in a container

xxyzzzq commented 7 years ago

From @richtr on July 1, 2015 11:10

Do we do anything special with a <video> without an audio track?

Not currently.

iOS doesn't make any special concessions between video tracks with or without audio. Media focus and media key access is still useful to play/pause a silent video via remote controls.

I guess the best solution is to allow a developer to iterate over tracks in a container

Could you be more specific? IIUC, even being able to do videoEl.audioTracks isn't going to be able to tell you if a video track emits audio.

xxyzzzq commented 7 years ago

From @foolip on July 1, 2015 11:35

We could very well limit the implicit activation to when one of the tracks in HTMLMediaElement.audioTracks is enabled. I don't think we should start involving the muted and volume state though, then we're really approaching the "audio ouput must have non-zero samples" model which we can't actually implement.

xxyzzzq commented 7 years ago

From @jakearchibald on July 1, 2015 11:52

I didn't realise .audioTracks was a thing. That's the answer here I think. As a developer I can decide on the session kind based on that.

For what it's worth, this is what I encountered that inspired this ticket:

  1. Played music in Google Music
  2. Opened Twitter
  3. Scrolled
  4. Encountered embedded screencast without sound, which autoplayed
  5. Google Music lost audio focus

…the solution in this case would have been:

xxyzzzq commented 7 years ago

From @foolip on July 1, 2015 12:21

I think this comes down to what default behavior breaks the least existing content. The worry is existing video-only or muted-by-default content that doesn't care about media sessions. They would have to create a new MediaSession("ambient") just to not interrupt others, and chances are they won't.

I was going to propose that the implicit activation for HTMLMediaElement only happens if there at least one enabled track in .audioTracks. (Note that audio/video tracks have not shipped yet, but we have the equivalent information internally.)

However, audio tracks can come and go, so what would we do if an audio track is added after playback has begun but we don't have an active session? The problem is similar to trying to activate a session only if the effective media volume is non-zero.

xxyzzzq commented 7 years ago

From @foolip on August 25, 2015 12:37

@jakearchibald, any thoughts on how we should fix this?

xxyzzzq commented 7 years ago

From @jernoble on January 14, 2016 18:59

This problem (defining the default behavior in the case where a