Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform MediaSession.kind into a set of bools/enums #46

Closed
foolip opened this issue Jun 8, 2015 · 7 comments
Closed

Transform MediaSession.kind into a set of bools/enums #46

foolip opened this issue Jun 8, 2015 · 7 comments
Labels

Comments

@foolip
Copy link
Member

foolip commented Jun 8, 2015

The MediaSession kind corresponds to a number of behaviors (does it interrupt others, can it mix with others, etc.) that we could expose directly:

partial interface MediaSession {
  attribute boolean transient;
  attribute boolean mixable;
  attribute boolean pauseInBackground; // silly name
}

The content kind would correspond to all of these being false, while e.g. transient-solo is {transient: true, mixable: false }.

In this setup, kinds would be a matter for HTMLMediaElement only.

@avayvod
Copy link
Contributor

avayvod commented Jun 8, 2015

Some combinations don't make sense, do they? E.g. { transient: false, mixable: true }

@richtr
Copy link
Member

richtr commented Jun 8, 2015

There's a certain simplicity in having a kind of media session.

As a web dev, I would much prefer to do new MediaSession('content') (or potentially even new MediaSession('music')) than new MediaSession({transient: false, mixable: false, pauseInBackground: false}).

These bools/enums also don't capture other behaviors like whether you want media key access or want to show interfaces in the notification or lock screen.

There is probably a compromise in here, where var session = new MediaSession('content') actually lists readonly properties of the media session as per your proposal (e.g. session.mixable === false, session.pauseInBackground === false, session.hasRemoteControls === true, etc).

@foolip
Copy link
Member Author

foolip commented Jun 8, 2015

For the combinations that don't make sense, we could throw an exception or (preferably) just coerce it into a state that does make sense, so new MediaSession({transient: false, mixable: true}) would give a session where both transient and mixable are false.

@foolip
Copy link
Member Author

foolip commented Jun 8, 2015

For some context, my concern here is that we'll have to double the number of kinds if a new aspect of media sessions are added, or have a mix of kind and bools. There is already one somewhat sensible thing we cannot express, namely a non-transient session that interrupts other playback, like content, but which also automatically pauses and resumes when it goes into the background, like ambient.

@doomdavve
Copy link
Contributor

Fwiw, foolip's last use case is present and called SoloAmbient on iOS.

@richtr
Copy link
Member

richtr commented Jun 8, 2015

There is already one somewhat sensible thing we cannot express, namely a non-transient session that interrupts other playback, like content, but which also automatically pauses and resumes when it goes into the background, like ambient.

Something like ambient-solo?

Fwiw, foolip's last use case is present and called SoloAmbient on iOS.

But it is not called {transient: false, mixable: false: pauseInBackground: true}.

@foolip
Copy link
Member Author

foolip commented Aug 25, 2015

Since we have not been able to actually come up with something better here, I'm going to close this.

@domenic, I know you supported this idea, so if you have some ideas for improvement please just suggest it and we'll try it out.

@foolip foolip closed this as completed Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants