admin管理员组文章数量:1279219
I am creating a Video Sniffing Framework where I have to sniff different browsers' HTML5 Video playing capability. For that I used the canPlayType() method which is giving me three possible results:
- the empty String (when unable to run the video)
- "maybe"
- "probably"
I need to know the exact difference between "maybe" and "probably". Please let me to know if anyone can resolve my confusion. Thanks in advance.
I am creating a Video Sniffing Framework where I have to sniff different browsers' HTML5 Video playing capability. For that I used the canPlayType() method which is giving me three possible results:
- the empty String (when unable to run the video)
- "maybe"
- "probably"
I need to know the exact difference between "maybe" and "probably". Please let me to know if anyone can resolve my confusion. Thanks in advance.
Share Improve this question edited Aug 20, 2013 at 22:00 Victor Zamanian 3,19028 silver badges32 bronze badges asked May 12, 2013 at 5:04 QriousQrious 811 silver badge2 bronze badges3 Answers
Reset to default 8probably
means that the browser can play the media type described. maybe
means that the type might be playable. Usually, this is because the media type described is not specific enough to make a decision.
For example, the type audio/ogg
may or may not be playable, because Ogg is a container type that could contain several different codecs. Vorbis and Opus are two Ogg-containable codecs. A browser's ability to play Ogg files in general says nothing about the browser's ability to play Vorbis or Opus codecs, so it can't say whether it can play your Ogg file.
If you ask about a specific codec with audio/ogg; codecs=vorbis
, then the browser can say for sure whether it can play that type.
To make an analogy: suppose you ask me if I am able to drive your boat. I am good at driving tiny speedboats, but I cannot drive a massive cruise boat. I must answer the question "Can you drive my boat?" with "Maybe," because you haven't told me exactly what type of boat it is.
Stating the W3 specification: http://www.w3/TR/2011/WD-html5-20110113/video.html#mime-types
media.canPlayType(type)
returns the empty string (a negative response), "maybe", or "probably" based on how confident the user agent is that it can play media resources of the given type.
More details are given on MDN: https://developer.mozilla/en/docs/Web/API/HTMLMediaElement#Methods
- "probably": if the specified type appears to be playable.
- "maybe": if it's impossible to tell whether the type is playable without playing it.
- The empty string: if the specified type definitely cannot be played.
Also, in some cases (although that seems to happen only for <audio>
elements), the returned value is "no"
instead of the empty string:
http://24ways/2010/the-state-of-html5-audio
http://diveintohtml5.info/everything.html
Source : http://www.w3schools./tags/av_met_canplaytype.asp
The canPlayType() method can return one of the following values:
- "probably" - the browser most likely supports this audio/video type
- "maybe" - the browser might support this audio/video type
- "" - (empty string) the browser does not support this audio/video type
本文标签: javascriptDifference between canPlayType maybe and probably outputStack Overflow
版权声明:本文标题:javascript - Difference between canPlayType maybe and probably output - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741216249a2360096.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论