Bug Tracker

Modify

Ticket #10374 (closed feature: wontfix)

Opened 3 years ago

Last modified 3 years ago

$('#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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 3 years ago by dmethvin

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.

comment:2 Changed 3 years ago by rwaldron

You could use  Popcorn.js

Version 0, edited 3 years ago by rwaldron (next)

comment:3 Changed 3 years ago by rwaldron

This will also do what you want...

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

comment:4 Changed 3 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to event

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.