Skip to main content

Bug Tracker

Side navigation

#9174 closed bug (invalid)

Opened May 08, 2011 01:52PM UTC

Closed May 08, 2011 04:09PM UTC

Last modified May 07, 2013 12:30PM UTC

creating video element causes video to play in background, even before adding it to the page

Reported by: bugs.jquery.com@sembiki.com Owned by:
Priority: low Milestone: 1.next
Component: manipulation Version: 1.6
Keywords: Cc:
Blocked by: Blocking:
Description

This happens sometimes, but not all of the time, in Firefox, Safari, and Chrome.

http://jsfiddle.net/cDpV9/8/

var v = $("<video id='v' src='http://ia600401.us.archive.org/18/items/ForrestPlaysTaik/forresto-plays-taik-banjo-360.webm' autobuffer='auto' preload autoplay controls></video>");

1. Create the video element

2. Hear it playing in background, even though it isn't in the DOM tree

3. Then if you add the element to the page with

.append(v)
the audio will be doubled

More: http://stackoverflow.com/questions/5927573/html5-video-playing-twice-audio-doubled-with-jquery-append

Attachments (0)
Change History (5)

Changed May 08, 2011 04:09PM UTC by rwaldron comment:1

component: unfiledmanipulation
priority: undecidedlow
resolution: → invalid
status: newclosed

Try removing the "autoplay" attribute.

Changed May 08, 2011 04:41PM UTC by bugs.jquery.com@sembiki.com comment:2

Isn't this a valid bug? I need it to autoplay. A workaround is to use

$("#player").html("<video id='v' src='http://ia600401.us.archive.org/18/items/ForrestPlaysTaik/forresto-plays-taik-banjo-360.webm' autobuffer='auto' preload autoplay controls></video>");

instead of

$("#player").append($("<video id='v' src='http://ia600401.us.archive.org/18/items/ForrestPlaysTaik/forresto-plays-taik-banjo-360.webm' autobuffer='auto' preload autoplay controls></video>"));

Changed May 08, 2011 04:52PM UTC by timmywil comment:3

This sounds like a browser bug. However, I've tried this before and I believe it will autoplay (whether the attribute is present or not) as soon as you append it so the autoplay attribute may be unnecessary in this case.

Changed May 08, 2011 05:19PM UTC by rwaldron comment:4

Again, removing the "autoplay" attribute corrects the issue: http://jsfiddle.net/rwaldron/cDpV9/9/

Changed May 07, 2013 12:30PM UTC by anonymous comment:5

Seems fixed in jquery 1.9