This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 19619 - Remove media="" from <source> if it isn't used
Summary: Remove media="" from <source> if it isn't used
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P4 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-19 06:36 UTC by contributor
Modified: 2014-02-10 14:49 UTC (History)
17 users (show)

See Also:


Attachments

Description contributor 2012-10-19 06:36:50 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html
Multipage: http://www.whatwg.org/C#the-source-element
Complete: http://www.whatwg.org/c#the-source-element

Comment:
Remove meida from source per
http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Jun/0286.html

Posted from: 79.119.101.74 by annevk@annevk.nl
User agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.8.2; U; en) Presto/2.10.289 Version/12.02
Comment 1 Philip Jägenstedt 2012-10-19 07:54:40 UTC
To quote myself from <http://www.iandevlin.com/blog/2012/08/html5/on-the-media-attribute>:

"Since Firefox has now also implemented it, the path of least resistance is to just leave it be."
Comment 2 Anne 2012-10-19 08:46:58 UTC
I suppose, but long term it's a maintenance cost and I rather reduce that than to keep useless features around.
Comment 3 Philip Jägenstedt 2012-10-19 09:11:21 UTC
I'm failing to come up with a strong opinion on this, but will of course be happy to remove support in Opera if it's dropped from the spec.
Comment 4 Ian Devlin 2012-10-19 09:47:46 UTC
I think it should remain as it has its uses, as specified in my article that Philip posted.
Comment 5 Odin Hørthe Omdal 2012-10-19 12:23:20 UTC
If we keep it too long, it's impossible to remove.

Better to remove it now than to wait.
Comment 6 Ian Devlin 2012-10-19 12:31:25 UTC
Like it was impossible to remove those elements - e.g. center and font - and attributes - e.g. name (img) and version (html) - from HTML 4.01 that have been deprecated?
Comment 7 Odin Hørthe Omdal 2012-10-19 12:45:10 UTC
Exactly. Once something is in the platform, it is forever there.

Except for version, which is indeed removed, but that was not really a feature/tag/attribute that did anything anyway.

Now that we have Media Source Extensions, we should rather make it damn easy to do adaptive streaming. MSE is the low level interface, -- it's not unthinkable to later fix something more high level. :-)
Comment 8 Mat Marquis 2012-10-19 12:47:43 UTC
This bug stands to remove a feature with practical applications — already in use by authors and implemented in every major desktop browser — and replace it with the the vague promise of a better solution eventually. Wouldn’t it make sense to wait for the better solution to materialize before we default to having _no_ specced solution?

-1.
Comment 9 Odin Hørthe Omdal 2012-10-19 12:59:20 UTC
Video and images are different.

Videos don't download fully for the page to load, they don't do speculative prefetch. That means you're fully able to do anything you want to do with video@media yourself with javascript.

Then you should also build a chooser for your users, so that they can choose what version to see/switch.

We already have a better solution, MSE is implemented and working in Chrome at least and there's lots of interest from all the vendors, they're actively participating.


So img and video have different needs, and work in different ways.
Comment 10 Mat Marquis 2012-10-19 14:19:22 UTC
> We already have a better solution, MSE is implemented and working in Chrome at least and there's lots of interest from all the vendors, they're actively participating.

I think we have a bit of a disconnect on what we consider to be a solved problem. This isn’t something authors could put into use on production websites anytime soon, so we’d still be using `media` in the interim regardless of its status in the spec. While the proposed alternative sounds great in theory and it’s heartening to hear that there’s interest from implementors, that doesn’t make it a solution of any use today — no more a “done deal” than any number of proposals. 

If the primary argument for removal is that this relatively new feature has seen little uptake from authors, it doesn’t make much sense to replace it with the promise of something that isn’t yet implemented consistently and cannot be used by authors. The removal of `media` attributes from the spec seems premature.
Comment 11 Odin Hørthe Omdal 2012-10-19 14:33:03 UTC
> If the primary argument for removal is that this relatively new feature has 
> seen little uptake from authors, it doesn’t make much sense to replace it with 
> the promise of something that isn’t yet implemented consistently and cannot be 
> used by authors.

That is not the primary reason at all. The primary reason is that media is a bad fit for the problem domain. It doesn't solve the problems (/use cases) that it's meant to in a good way.

You can do content negotiation for video today:

  <video src=small-video.ogv preload=none>

Add some javascript to progressively enhance that and replace the source with something a bit more fitting for the resolution. It should also show links to the higher resolution video clips.

That is as good as the in-browser mode, it has much more power and works just as well. The only place where it won't work well, is if the user has turned javascript off, but then they still get the video and can play that, and they will be able to choose one of the alternatives.

Actually, listing all the sources in the tag might be even better for fallback, although more boring for me to write, ohwell:

  <video preload=none>
    <source src=small-video.ogv>
    <source src=big-video.ogv>
  </video>

(Plus all that extra stuff I'd add if this was not an example ;-) ).



So that's the reason. You can do something extremely similar today, and since that's already doable, and this extra feature doesn't add anything extra, nor does it really solve the full problem, it should be removed from the spec and the implementations.

Learning that Chrome and Safari implement it as well makes that a fair bit harder, -- but actually removing it won't have really bad sideeffects thankfully. No broken pages, just potentially someone getting a different resource than they'd otherwise get. So same as Internet Explorer.


And it not really being used much now helps *that* side of the coin. :-) It makes it much easier to remove.
Comment 12 Ian 'Hixie' Hickson 2012-10-19 20:24:29 UTC
cc'ing Dave Singer who was instrumental in media=""'s original design IIRC.
Comment 13 Ian 'Hixie' Hickson 2013-01-26 05:47:33 UTC
So does anyone use media=""? (URLs to real sites showing this use would be very convincing in terms of an argument for keeping this.)

Anyone from Mozilla have an opinion?

Dave, any opinion?
Comment 14 Marcos Caceres 2013-01-29 17:41:12 UTC
(In reply to comment #13)
> So does anyone use media=""? (URLs to real sites showing this use would be
> very convincing in terms of an argument for keeping this.)

I did a grep on the content of "35,830 home pages from the top 50,000 most popular web sites" [1] using the following expression: .*<video.*\smedia\s*=. 

Although the video tag was used 98 times in the data, the query above returned 0 results. The search is single line, so there is a risk I missed a hit... though the number would still be relatively small.  

The data is from December, 2012. 

[1] http://webdevdata.org
Comment 15 Mat Marquis 2013-01-30 21:42:41 UTC
A search through webdevdata (a 35800-page sample) just now turned up that 7.7% of `source` elements have a `media` attribute. 

Using `rep "<source" * | grep "media=" | wc -l` as the query.
Comment 16 Ian 'Hixie' Hickson 2013-03-22 18:03:30 UTC
Mat, do you have any of the URLs for those pages? It's not unusual for people to give attributes with empty values — if you look at just which attributes get used, <a shape> comes out far further ahead than if you look at what pages actually use it for real, for example.

What browsers implement <source media>?
Comment 17 Mat Marquis 2013-03-22 19:16:01 UTC
Current Use:

`grep "<source" . -r | grep "media=[\'\"]\s*(" | wc -l` turns up four instances of `media` attributes on `source` elements that do not match one of the following patterns:
`media="(` | `media='(` | `media=" (` | `media=' (`

Interestingly, `grep "<source" . -r | grep "media=[\'\"]\s*m" | wc -l` turns up three matches for:
`media=' m` | `media='m` | `media=" m` | `media="m`

This may be evidence of an  authoring error, as it would match `media="min-…`, `media="max-…` and so on. Worth noting is that this data is from December of 2012, and I see no reason to believe that usage has declined as browser support has increased.

Support:

All modern desktop browsers support `media`, at present [1]. We’ve put together a <a href="http://www.zachleat.com/test/media-on-video/video-media.html">test page</a> for support, and `media` is supported on a video `source` element as early as the following browsers—possibly earlier, given the limited number of devices/browsers we had at-hand.

* Current Chrome
* iOS 5
* Android 2.3
* Firefox 15
* Opera 12
* Safari 6
* IE 9
* Windows Phone 7.5
* Blackberry 6

Thanks,
-Mat

1: https://developer.mozilla.org/en-US/docs/HTML/Element/source
Comment 18 Simon Pieters 2013-04-08 13:20:44 UTC
$ grep -aEor "<source\s+([^>]+\s)?media\s*=[^>]+>" .
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megapubs__default/public/serials/covers/cprv34n6.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megapubs__default-15x/public/serials/covers/cprv34n6.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megapubs__default-2x/public/serials/covers/cprv34n6.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="94" height="120" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megapubs__default/public/serials/covers/cprv34n6.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megapubs__default-15x/public/serials/covers/cprv34n6.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megapubs__default-2x/public/serials/covers/cprv34n6.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="94" height="120" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default/public/multimedia/podcast/nowrasteh.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-15x/public/multimedia/podcast/nowrasteh.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-2x/public/multimedia/podcast/nowrasteh.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="210" height="118"  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default/public/multimedia/podcast/nowrasteh.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-15x/public/multimedia/podcast/nowrasteh.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-2x/public/multimedia/podcast/nowrasteh.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="210" height="118"  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="210" height="118" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megamulti__default-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="210" height="118" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megabooks__default/public/books/fire-next-door.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megabooks__default-15x/public/books/fire-next-door.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megabooks__default-2x/public/books/fire-next-door.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="110" height="172" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__megabooks__default/public/books/fire-next-door.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megabooks__default-15x/public/books/fire-next-door.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__megabooks__default-2x/public/books/fire-next-door.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="110" height="172" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__default/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__default-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__default-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="320" height="180" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__default/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__default-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__default-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="320" height="180" alt=""  />
./cato.org.html:<source media="(min-width: 400px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth400/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth400-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth400-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-minwidth400" typeof="foaf:Image"  width="400" height="225" alt=""  />
./cato.org.html:<source media="(min-width: 400px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth400/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth400-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth400-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-minwidth400" typeof="foaf:Image"  width="400" height="225" alt=""  />
./cato.org.html:<source media="(min-width: 800px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth800/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth800-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth800-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-minwidth800" typeof="foaf:Image"  width="506" height="285" alt=""  />
./cato.org.html:<source media="(min-width: 800px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth800/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth800-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth800-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-minwidth800" typeof="foaf:Image"  width="506" height="285" alt=""  />
./cato.org.html:<source media="(min-width: 1000px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth1000/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth1000-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth1000-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-minwidth1000" typeof="foaf:Image"  width="621" height="350" alt=""  />
./cato.org.html:<source media="(min-width: 1000px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth1000/public/homepage-images/201212_capitalgains_hp_mini.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth1000-15x/public/homepage-images/201212_capitalgains_hp_mini.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-items__minwidth1000-2x/public/homepage-images/201212_capitalgains_hp_mini.jpg 2x"  class="resp-img-picture resp-img-picture-minwidth1000" typeof="foaf:Image"  width="621" height="350" alt=""  />
./cato.org.html:<source media="(max-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-maxwidth600" typeof="foaf:Image"  width="400" height="226" alt=""  />
./cato.org.html:<source media="(max-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-maxwidth600" typeof="foaf:Image"  width="400" height="226" alt=""  />
./cato.org.html:<source media="(min-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-width600" typeof="foaf:Image"  width="213" height="120" alt=""  />
./cato.org.html:<source media="(min-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-width600" typeof="foaf:Image"  width="213" height="120" alt=""  />
./cato.org.html:<source media="(max-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-maxwidth600" typeof="foaf:Image"  width="400" height="226"  />
./cato.org.html:<source media="(max-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__maxwidth600-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-maxwidth600" typeof="foaf:Image"  width="400" height="226"  />
./cato.org.html:<source media="(min-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-width600" typeof="foaf:Image"  width="213" height="120"  />
./cato.org.html:<source media="(min-width: 600px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__homepage-sidebar-multimedia__width600-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-width600" typeof="foaf:Image"  width="213" height="120"  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="200" height="113" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides/public/multimedia/podcast/jsanchez.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-15x/public/multimedia/podcast/jsanchez.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-2x/public/multimedia/podcast/jsanchez.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="200" height="113" alt=""  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="200" height="113"  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="200" height="113"  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="200" height="113"  />
./cato.org.html:<source media="(min-width: 0px)" srcset="http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides/public/multimedia/podcast/preble.jpg 1x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-15x/public/multimedia/podcast/preble.jpg 1.5x, http://www.cato.org/sites/cato.org/files/styles/resp__img__multimedia-sides-2x/public/multimedia/podcast/preble.jpg 2x"  class="resp-img-picture resp-img-picture-Default" typeof="foaf:Image"  width="200" height="113"  />
./swr.de.html:<source media="min-width:512px" src="rtmp://fc-ondemand.swr.de/a4332/e6/nachrichten/bw/20121227/593264.m.mp4" type="video/x-mp4">
./swr.de.html:<source media="min-width:960px" src="rtmp://fc-ondemand.swr.de/a4332/e6/nachrichten/bw/20121227/593264.l.mp4" type="video/x-mp4">
./swr.de.html:<source media="min-width:256px" src="rtmp://fc-ondemand.swr.de/a4332/e6/nachrichten/bw/20121227/593264.s.mp4" type="video/x-mp4">
./swr.de.html:<source media="all" src="http://ios-ondemand.swr.de/i/nachrichten/bw/20121227/593264.,m,l,s,.mp4.csmil/master.m3u8" type="video/mp4">
Comment 19 Simon Pieters 2013-04-08 13:27:04 UTC
The cato.org site doesn't appear to use media elements but uses <picture>, so it can be ignored.

The swr.de site is the only site that uses <source media> with a media element in the data set. The markup used is:

       <video controls="controls" height="240" id="videoPlayer11235134_id3053672_v" poster="http://www.swr.de/-/id=11226832/property=medium/958ja5/index.jpg" width="388">
          
             <source media="min-width:960px" src="rtmp://fm-ondemand.swr.de/ondemand/swr-fernsehen/marktcheck/mc-klaert-auf/spielzeug-richtlinie.l.mp4" type="video/x-mp4"></source>
          
             <source media="min-width:512px" src="rtmp://fm-ondemand.swr.de/ondemand/swr-fernsehen/marktcheck/mc-klaert-auf/spielzeug-richtlinie.m.mp4" type="video/x-mp4"></source>
          
             <source media="min-width:256px" src="rtmp://fm-ondemand.swr.de/ondemand/swr-fernsehen/marktcheck/mc-klaert-auf/spielzeug-richtlinie.s.mp4" type="video/x-mp4"></source>
          
          <source media="all" src="http://ios-ondemand.swr.de/i/swr-fernsehen/marktcheck/mc-klaert-auf/spielzeug-richtlinie.,l,m,s,.mp4.csmil/master.m3u8" type="video/mp4"></source>
          
          <div class="flashErrorList">
          <p class="flashError">Um das Video im Flash-Player abzuspielen, installieren Sie bitte das kostenlose <a href="http://get.adobe.com/de/flashplayer/" onclick="window.open('http://get.adobe.com/de/flashplayer/'); return false;">Flash-Plugin</a> von Adobe für Ihren Browser.
             </p>
          
          </div>
       </video>
Comment 20 Ian 'Hixie' Hickson 2013-04-15 22:19:32 UTC
"One site in the data set uses non-blank media="" on <source> and its use is invalid" is a different story than the 7.7% number cited earlier... Removing it becomes a lot more possible at this usage level.

foolip argued to keep it.

I think the right next step here would be for a browser vendor to drop support. If no vendor is willing to do that, it's probably not worth removing it from the spec.
Comment 21 Zach Leatherman 2013-05-16 23:51:56 UTC
A few things about the webdevdata.org data set:
* Only 239 of almost 36000 home pages were even using a <video> tag, compared to 9347 instances of an <object> tag.
* This makes me wonder: What User Agent was used to collect this data? I opened up a few of the sample pages and it looks like they are all “desktop” layouts. If developers are changing the HTML to conditionally serve HTML5 video over Flash video, this data set will be biased and not very useful to draw conclusions from.


I definitely agree that img and video should be treated differently. I also think that ignoring the use case of preloading a resolution-appropriate stream without a JS-chooser would be a mistake. Developers shouldn’t have to choose between enabling preload and a JavaScript replacement for media. If we leave media as is, developers can have both.
Comment 22 Simon Pieters 2013-05-17 08:24:30 UTC
(In reply to comment #21)
> A few things about the webdevdata.org data set:
> * Only 239 of almost 36000 home pages were even using a <video> tag,
> compared to 9347 instances of an <object> tag.
> * This makes me wonder: What User Agent was used to collect this data?

Probably whatever python's urlopen() uses by default. See https://github.com/Webdevdata/webdevdata.org/blob/master/downloadr.py (though I think this exact script wasn't used to download the data cited here).

> I
> opened up a few of the sample pages and it looks like they are all “desktop”
> layouts. If developers are changing the HTML to conditionally serve HTML5
> video over Flash video, this data set will be biased and not very useful to
> draw conclusions from.

Yes, it is biased in various ways, for instance it only contains "front" pages.

A data set with a different bias, like with a UA string of iPhone Safari (for instance), and with more "deep" pages, would be useful, but I'm not aware of anyone having collected and published such data.

> I definitely agree that img and video should be treated differently. I also
> think that ignoring the use case of preloading a resolution-appropriate
> stream without a JS-chooser would be a mistake. Developers shouldn’t have to
> choose between enabling preload and a JavaScript replacement for media. If
> we leave media as is, developers can have both.

The alternative isn't necessarily a JS-chooser. It could be handled by the user agent and the server, for instance.
Comment 23 Zach Leatherman 2013-05-17 15:38:44 UTC
Do you have access to the exact script used to gather the data? I could look into modifying it to gather better data, even though I believe the burden of proof should be on those that favor removal.

 > The alternative isn't necessarily a JS-chooser. It could be handled
 > by the user agent and the server, for instance.

I don’t think there is a one-to-one overlap between what you could accomplish with a JS-replacement for media (or <source media> for that matter) and UA detection. One example would be that viewport size is not available from UA detection.

I believe that the work done by Ilya Grigorik on HTTP Client Hints says it better: https://github.com/igrigorik/http-client-hints
Comment 24 Simon Pieters 2013-05-20 12:47:58 UTC
(In reply to comment #23)
> Do you have access to the exact script used to gather the data?

No, but I filed https://github.com/Webdevdata/webdevdata.org/issues/10

> I could look
> into modifying it to gather better data, even though I believe the burden of
> proof should be on those that favor removal.

That would be awesome. :-)

>  > The alternative isn't necessarily a JS-chooser. It could be handled
>  > by the user agent and the server, for instance.
> 
> I don’t think there is a one-to-one overlap between what you could
> accomplish with a JS-replacement for media (or <source media> for that
> matter) and UA detection. One example would be that viewport size is not
> available from UA detection.

I didn't say UA detection. I said it could be handled by the user agent and the server. That is, for instance, you use markup like

<video src="somevideo.foobar"></video>

and the choice of video stream is negotiated between the browser and the server in some manner over the network.

> I believe that the work done by Ilya Grigorik on HTTP Client Hints says it
> better: https://github.com/igrigorik/http-client-hints
Comment 25 Ian 'Hixie' Hickson 2013-10-21 20:49:35 UTC
Any vendors dropped this feature? (foolip? roc?)
Comment 26 Robert O'Callahan (Mozilla) 2013-10-22 08:31:59 UTC
We haven't.
Comment 27 Philip Jägenstedt 2013-10-22 08:37:25 UTC
I never dropped support in Presto and see that it's still in Blink. I would like to see it die, so I'll try to add a UseCounter to see if it's actually used in the wild. If the Blink owners accept that, we'll have to wait for a Chrome release cycle to get the data.
Comment 28 Philip Jägenstedt 2013-10-22 08:42:19 UTC
Trying add a UseCounter in https://code.google.com/p/chromium/issues/detail?id=310006
Comment 29 Philip Jägenstedt 2013-10-22 11:47:03 UTC
It's in Blink now, I'll report back here when the results are in.
Comment 30 Philip Jägenstedt 2014-01-16 06:02:59 UTC
The use counter has been in for long enough to collect some good data. These are the numbers we got:

SourceElementCandidate            0.21%
SourceElementNonMatchingMedia     0.00003%

What this means is that 0.21% of pages considered a source element candidate (the "Process candidate" step in the resource selection algorithm) but only 0.00003% of pages had a source element that failed to be selected due to the media attribute.

The usage is much lower than other features that have been removed from Blink. My personal preference is to remove it from spec and implementation immediately, but I cannot make promises on behalf of the Blink community.

Hixie, what's the next step here?
Comment 31 Marcos Caceres 2014-01-16 15:18:40 UTC
We might still need media on source for <picture>, so please don't remove the attribute altogether. Maybe just make it have no effect in the context of <audio> and <video>.

FWIW, <picture> is on Mozilla's DOM team's road map for Q1: 
https://etherpad.mozilla.org/domwebapi2014q1
Comment 32 Philip Jägenstedt 2014-01-16 15:56:32 UTC
(In reply to Marcos Caceres from comment #31)
> We might still need media on source for <picture>, so please don't remove
> the attribute altogether. Maybe just make it have no effect in the context
> of <audio> and <video>.
> 
> FWIW, <picture> is on Mozilla's DOM team's road map for Q1: 
> https://etherpad.mozilla.org/domwebapi2014q1

No need to worry, even if the HTML spec drops the media IDL attribute on HTMLSourceElement, the <picture> spec can just define it back into existence.
Comment 33 Philip Jägenstedt 2014-02-03 04:31:42 UTC
(In reply to Ian 'Hixie' Hickson from comment #20)
> "One site in the data set uses non-blank media="" on <source> and its use is
> invalid" is a different story than the 7.7% number cited earlier... Removing
> it becomes a lot more possible at this usage level.
> 
> foolip argued to keep it.
> 
> I think the right next step here would be for a browser vendor to drop
> support. If no vendor is willing to do that, it's probably not worth
> removing it from the spec.

I've removed it from Blink now: http://crbug.com/338197

Note that HTMLSourceElement.media IDL attribute is still there, but I've added a UseCounter to get rid of it as soon as the data allows.
Comment 34 Ian 'Hixie' Hickson 2014-02-06 23:06:28 UTC
Ok well given that usage data and the fact that it's essentially useless, I've removed it.

Marcos: (Please don't use <source> for anything else. It's not been a success story and we shouldn't design things based on it.)
Comment 35 contributor 2014-02-06 23:06:39 UTC
Checked in as WHATWG revision r8472.
Check-in comment: Drop <source media> since nobody uses it and it is mostly useless anyway.
http://html5.org/tools/web-apps-tracker?from=8471&to=8472
Comment 36 Ryan L. Frederick 2014-02-09 02:34:00 UTC
As a dev who implemented `media` on <video> in the last few months on an intranet site for one of the big social network orgs, I want to voice my disappointment with this decision. The project I worked on was a responsive site targeting all devices; we serve small versions of all video media to narrow screens as an easy way to save bandwidth and improve performance.

As previously mentioned in this thread, this is a real use case with real impact on end users of web media. The only candidate technology mentioned as a replacement here (MSE) is not only less mature but also <a href="https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#examples">significantly more complicated</a>. For simple use cases, an equally simple, declarative approach like `media` is far more appealing than a JS API like MSE.

I agree the argument from lack of use is credible. In defence of the media attribute, my experience is that a *lot* of organizations are still behind the curve and are just now embracing responsive techniques to replace their limited desktop sites. Although I’m aware this point is speculative, I’d be willing to bet that over the next few years more than 0.00003% of projects will discover they want this feature. I would prefer they found out they could use it.
Comment 37 Philip Jägenstedt 2014-02-09 06:29:23 UTC
(In reply to Ryan L. Frederick from comment #36)
> As previously mentioned in this thread, this is a real use case with real
> impact on end users of web media. The only candidate technology mentioned as
> a replacement here (MSE) is not only less mature but also <a
> href="https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-
> source.html#examples">significantly more complicated</a>. For simple use
> cases, an equally simple, declarative approach like `media` is far more
> appealing than a JS API like MSE.

You can also replace it with something like:

if (window.matchMedia("(max-width: 300px)").matches)
  video.src = 'small.webm';
else
  video.src = 'large.webm';

With matchMedia you can also adapt to changes, which is something the media attribute just didn't do. Of course you'd have to use MSE to make the transition gapless, but a pause when switching still seems better than having to reload the whole page after resizing the browser window.
Comment 38 Ian Devlin 2014-02-09 15:28:25 UTC
I find the argument that the media attribute doesn't adapt to changed
browser sizes rather pointles as generally you would be using the media
attribute to target specific devices and serve them a smaller video size.
They are not going to suddenly change size much mid view and want a bigger
file.
Comment 39 Ryan L. Frederick 2014-02-09 22:43:25 UTC
(In reply to Philip Jägenstedt from comment #37)
> (In reply to Ryan L. Frederick from comment #36)
> > As previously mentioned in this thread, this is a real use case with real
> > impact on end users of web media. The only candidate technology mentioned as
> > a replacement here (MSE) is not only less mature but also <a
> > href="https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-
> > source.html#examples">significantly more complicated</a>. For simple use
> > cases, an equally simple, declarative approach like `media` is far more
> > appealing than a JS API like MSE.
> 
> You can also replace it with something like:
> 
> if (window.matchMedia("(max-width: 300px)").matches)
>   video.src = 'small.webm';
> else
>   video.src = 'large.webm';
> 
> With matchMedia you can also adapt to changes, which is something the media
> attribute just didn't do. Of course you'd have to use MSE to make the
> transition gapless, but a pause when switching still seems better than
> having to reload the whole page after resizing the browser window.

That’s true, although a real-world implementation would be a little more complex due to the lack of a universally-supported codec. Could any current source-matching implementations become “confused” as a script updates multiple <source> elements to point to new mp4, ogg and webm files? (Disclaimer: I don’t know if this is a sensible question or not.)

I also am not particularly worried about source updates on window resize: it’s an edge-case even from my point of view.
Comment 40 Simon Pieters 2014-02-10 14:35:27 UTC
(In reply to Ian Devlin from comment #38)
> I find the argument that the media attribute doesn't adapt to changed
> browser sizes rather pointles as generally you would be using the media
> attribute to target specific devices and serve them a smaller video size.
> They are not going to suddenly change size much mid view and want a bigger
> file.

The width media query changes if the user rotates the device or goes from a non-maximized window to fullscreen.
Comment 41 Ian Devlin 2014-02-10 14:43:22 UTC
(In reply to Simon Pieters from comment #40)
> (In reply to Ian Devlin from comment #38)
> > I find the argument that the media attribute doesn't adapt to changed
> > browser sizes rather pointles as generally you would be using the media
> > attribute to target specific devices and serve them a smaller video size.
> > They are not going to suddenly change size much mid view and want a bigger
> > file.
> 
> The width media query changes if the user rotates the device or goes from a
> non-maximized window to fullscreen.

I'm aware of that, but it wouldn't change enough for anyone to think "hang on, they need the 50MB high-res video now instead of the 10MB one".
Comment 42 Simon Pieters 2014-02-10 14:49:07 UTC
(In reply to Ryan L. Frederick from comment #39)
> That’s true, although a real-world implementation would be a little more
> complex due to the lack of a universally-supported codec. Could any current
> source-matching implementations become “confused” as a script updates
> multiple <source> elements to point to new mp4, ogg and webm files?
> (Disclaimer: I don’t know if this is a sensible question or not.)

Dynamic changes to <source> doesn't do anything, you have to call load() for it to have an effect. Alternatively you could use canPlayType() and <video src>.