8 ms·
That would break more than it would fix. Video is hard (not all devices or browsers support the same codecs, bitrates, frame rates, etc), and YouTube has to use
by cornstalks 11y ago
That would break more than it would fix. Video is hard (not all devices or browsers support the same codecs, bitrates, frame rates, etc), and YouTube has to use the User Agent to try to serve videos that the client can actually play. A random User Agent would mean that all those browsers that need a special video format wouldn't get the type of video they need, which sounds like a crappy world to live in (compared to the crappy world we already live in with meaningful User Agents).
- kuschku 11y ago> (compared to the crappy world we already live in with meaningful User Agents). > Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36 Google Chrome tells us it is: a Mozilla, it is AppleWebkit, it is KHTML, it is Gecko, it is Safari, and it is Chrome. "Meaningful" is something different.
- geofft 11y agoIt's meaningful. It communicates exactly what the browser is to anyone who is capable of receiving the intended communication. (It also communicates other things to people who are not, but "Google Chrome 41.0.2228.0" would be absolutely meaningless to these listeners, so that doesn't seem like an objection with merit.) You might object to the form of the communication, but that doesn't render the communication inexact. Just think of it as browser slang.
- pdkl95 11y ago> It communicates exactly what the browser is This is true, which is not particularly useful when deciding if a feature is available. Using the user agent to make this decision incorrectly assumes that all user agents of a particular browser+version all support exactly the same set of features. This is obviously not true. The user agent may be meaningful[1], but the meaning that it communicates isn't feature data. [1] If you take the header at it's word; as the bug being discussed demonstrates, user ages may be lying.
- cornstalks 11y ago> [...] the meaning that it communicates isn't feature data. But it kind of is (to some degree, at least). VP9 was recently added to Firefox 28. If the User Agent says the browser is Firefox 27, then you probably shouldn't try serving VP9 to that browser. Obviously the User Agent doesn't communicate the complete feature set. But some useful inferences regarding features can be derived from it.
- Dylan16807 11y agoThe user agent header is not the place to look for those.
- cornstalks 11y agoIt shouldn't be the only input signal for determining those things, but it can definitely be useful (i.e. "this codec is only supported in vX.Y+ of this browser", or "vX.Y of this browser has a bug handling this type of video", etc.). It's not like YouTube is a company of full of nothing but dopy idiots. I don't think they'd be using the User Agent if there was a better alternative.
- daxelrod 11y ago> YouTube has to use the User Agent to try to serve videos that the client can actually play. Why? We have JavaScript feature detection for video tags: http://diveinto.html5doctor.com/detect.html#video-formats http://diveinto.html5doctor.com/detect.html#video-formats
- 0x0 11y ago"Probably" and "maybe" values are, uh, probably not good enough.
- SomeCallMeTim 11y agoI thought you were being facetious. Sigh. Damn, but that's broken. I've worked with video format streaming, though, and encountered a situation where there was a driver on a certain Android device manufactured by a major hardware vendor that you've certainly heard of, and their driver silently corrupted video that was using low-latency streaming options. And by "corrupted" I mean that, while a few of the pixels looked almost right, sometimes, it was mostly just garbage and blank grey screens. I gave them a sample stream that failed, and they verified that yes, it's their fault. And that no, they weren't going to ship an update for it. Sorry. Device had been out for two years. Apparently no one thought to actually test the various standard options in that video codec. It works with the "normal" options? Ship it! So I totally understand the need to look at UA strings. I had to look for that particular device hardware profile and disable the low-latency streaming options in order for our product to work on that device.
- timothya 11y agoThat sort of feature detection is likely not sufficient for detecting if a video will play well or correctly. There's been a number of bugs in MSE in the past which means that YouTube has to fall back on browser version checks to avoid a bad user experience.
- lazaroclapp 11y agoTo be fair, a certain school of thought would say that those bugs are the browser's to fix, and that websites should deliver the browser whichever video it claims to support. If the browser advertises support for something it doesn't support, then it is up to browser developers (not web developers) to fix either the support or the advertisement thereof. Edit: Not saying that's always correct, but there does seem to be a tension between: "make sure your code can work well, even in a bad environment" and "don't mask bugs, instead fix them where it makes the most sense to do so" (in this case: in the dozens of browsers instead of in millions of websites).