Bug 21336 - MSE apps need a way to do resource selection
MSE apps need a way to do resource selection
Status: RESOLVED WONTFIX
Product: HTML WG
Classification: Unclassified
Component: Media Source Extensions
unspecified
PC All
: P2 normal
: ---
Assigned To: Adrian Bateman [MSFT]
HTML WG Bugzilla archive list
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-19 14:58 UTC by Mark Watson
Modified: 2013-03-25 20:55 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Watson 2013-03-19 14:58:19 UTC
The HTML Media Element resource selection algorithm provides a way to select between multiple resources specified using the <source> element according to two criteria
- whether the 'type' attribute is supported by the media element
- whether the 'media' attribute 'matches the current environment'

The 'media' attribute is a media query and can be used, for example, to specify different resources for different screen sizes.

MSE apps need a way to do the same kind of resource selection, but currently we only have a way to check type support using 'isTypeSupported'.

We need a way to check whether a media query 'matches the current environment'.
Comment 1 Mark Watson 2013-03-19 15:03:59 UTC
I think this may be addressed with the window.matchMedia() method:

http://www.w3.org/TR/cssom-view/#dom-window-matchmedia
Comment 2 Aaron Colwell (c) 2013-03-20 15:25:35 UTC
(In reply to comment #1)
> I think this may be addressed with the window.matchMedia() method:
> 
> http://www.w3.org/TR/cssom-view/#dom-window-matchmedia

I'm confused about what the action is here. Are you saying that matchMedia() supports what you want? I don't think it makes sense to try to reuse <source> functionality since the application already requires JavaScript to run to create the MediaSource object and generate the blob URL. It could call isTypeSupported() to detect MediaSource support and matchMedia() to select the right assets to fetch. Am I missing something here?
Comment 3 Mark Watson 2013-03-20 15:59:10 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > I think this may be addressed with the window.matchMedia() method:
> > 
> > http://www.w3.org/TR/cssom-view/#dom-window-matchmedia
> 
> I'm confused about what the action is here. Are you saying that matchMedia()
> supports what you want? I don't think it makes sense to try to reuse
> <source> functionality since the application already requires JavaScript to
> run to create the MediaSource object and generate the blob URL. It could
> call isTypeSupported() to detect MediaSource support and matchMedia() to
> select the right assets to fetch. Am I missing something here?

No, I think mediaMatch() probably addresses the requirement. Seems that you could implement the equivalent of the HTMLMediaElement resource selection algorithm in Javascript using isTypeSupported and mediaMatch.

The 'probably' is only because my understanding of media queries and CSS is limited. If it looks to people more familiar with this stuff that this meets the requirement we can close this bug.