Skip to main content

Bug Tracker

Side navigation

#10374 closed feature (wontfix)

Opened September 28, 2011 11:44PM UTC

Closed September 29, 2011 12:10AM UTC

$('#audio').play() should use first compatible source tag

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: event Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:
Description

When using the HTML5

<audio>
tag such as this:

<audio id="sound" preload="auto">
  <source src="sound.ogg" type="audio/ogg">
  <source src="sound.wav" type="audio/wav">
</audio>

I expected

$('#sound').play()
to trigger playing, but it returned no such method. Instead I have to specify
$('#sound')[0].play()
or
$('#sound').[1].play()
. It would be great if jQuery supported
$('#sound').play()
to play the first source type compatible with the current browser, as well as the other methods.

Attachments (0)
Change History (4)

Changed September 28, 2011 11:51PM UTC by dmethvin comment:1

To do that we'd need to add a jQuery method name for each DOM element method name. And of course that method would do nothing for non-media elements so it doesn't seem like it would be worth the extra bytes it would take. You could write a small plugin to do it though.

Changed September 29, 2011 12:07AM UTC by rwaldron comment:2

_comment0: You could use [http://popcornjs.org/ Popcorn.js]1317254915840136

You could use Popcorn.js which specializes in optimized media element programming (shameless plug).

Changed September 29, 2011 12:10AM UTC by rwaldron comment:3

This will also do what you want...

http://jsfiddle.net/rwaldron/nNvgW/

Changed September 29, 2011 12:10AM UTC by rwaldron comment:4

component: unfiledevent
priority: undecidedlow
resolution: → wontfix
status: newclosed