<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: HTML5 Audio Loops</title>
	<atom:link href="http://forestmist.org/2010/04/html5-audio-loops/feed/" rel="self" type="application/rss+xml" />
	<link>http://forestmist.org/2010/04/html5-audio-loops/</link>
	<description></description>
	<lastBuildDate>Sun, 05 Feb 2012 10:36:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: beatbutcher</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-36595</link>
		<dc:creator>beatbutcher</dc:creator>
		<pubDate>Sun, 01 Jan 2012 23:17:05 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-36595</guid>
		<description>No audio playing on safari 5.1.2, why I don&#039;t know. When I make version go&#039;s but with a gap.
Opera works smoooot all 3 methods.</description>
		<content:encoded><![CDATA[<p>No audio playing on safari 5.1.2, why I don&#8217;t know. When I make version go&#8217;s but with a gap.<br />
Opera works smoooot all 3 methods.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-36549</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Sat, 31 Dec 2011 00:05:26 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-36549</guid>
		<description>Gary, sure thing. Try out the example code at http://jsfiddle.net/ForestMist/jSJgV/ and let me know if you have any questions.</description>
		<content:encoded><![CDATA[<p>Gary, sure thing. Try out the example code at <a href="http://jsfiddle.net/ForestMist/jSJgV/" rel="nofollow">http://jsfiddle.net/ForestMist/jSJgV/</a> and let me know if you have any questions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary Dauphin</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-36545</link>
		<dc:creator>Gary Dauphin</dc:creator>
		<pubDate>Fri, 30 Dec 2011 22:23:51 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-36545</guid>
		<description>As a javascript noob, I could use some advice on this little script:

document.getElementById(&#039;audio_2&#039;).addEventListener(&#039;ended&#039;, function(){
2
this.currentTime = 0;
3
}, false);


I want to use this script to redirect the browser to another web page, after the music has played.  Can someone kindly show me the specific way I would do this, if the target web page was &quot;http://mypage.com/abc.html&quot; ?</description>
		<content:encoded><![CDATA[<p>As a javascript noob, I could use some advice on this little script:</p>
<p>document.getElementById(&#8216;audio_2&#8242;).addEventListener(&#8216;ended&#8217;, function(){<br />
2<br />
this.currentTime = 0;<br />
3<br />
}, false);</p>
<p>I want to use this script to redirect the browser to another web page, after the music has played.  Can someone kindly show me the specific way I would do this, if the target web page was &#8220;http://mypage.com/abc.html&#8221; ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-34454</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Wed, 26 Oct 2011 19:51:42 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-34454</guid>
		<description>Good question! 

From what I understand you can&#039;t easily remove an EventListener that was defined with an anonymous function like in the example above. You can however do something like this (try it via the Chrome Inspector Console)...

var bork = function() { alert(&#039;bork bork bork&#039;) };
document.getElementById(&#039;audio_3&#039;).addEventListener(&#039;ended&#039;, bork, false);

Now play audio_3 and you&#039;ll get a special message from the Swedish Chef.

document.getElementById(&#039;audio_3&#039;).removeEventListener(&#039;ended&#039;, bork);

Now play audio_3 again and no more Swedish Chef. *sniff*

So as long as you create your EventLister non-anonymously you should be set. :)

More info at http://www.quirksmode.org/js/events_advanced.html and http://stackoverflow.com/questions/4950115/removeeventlistener-on-anonymous-functions-in-javascript.</description>
		<content:encoded><![CDATA[<p>Good question! </p>
<p>From what I understand you can&#8217;t easily remove an EventListener that was defined with an anonymous function like in the example above. You can however do something like this (try it via the Chrome Inspector Console)&#8230;</p>
<p>var bork = function() { alert(&#8216;bork bork bork&#8217;) };<br />
document.getElementById(&#8216;audio_3&#8242;).addEventListener(&#8216;ended&#8217;, bork, false);</p>
<p>Now play audio_3 and you&#8217;ll get a special message from the Swedish Chef.</p>
<p>document.getElementById(&#8216;audio_3&#8242;).removeEventListener(&#8216;ended&#8217;, bork);</p>
<p>Now play audio_3 again and no more Swedish Chef. *sniff*</p>
<p>So as long as you create your EventLister non-anonymously you should be set. <img src='http://forestmist.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>More info at <a href="http://www.quirksmode.org/js/events_advanced.html" rel="nofollow">http://www.quirksmode.org/js/events_advanced.html</a> and <a href="http://stackoverflow.com/questions/4950115/removeeventlistener-on-anonymous-functions-in-javascript" rel="nofollow">http://stackoverflow.com/questions/4950115/removeeventlistener-on-anonymous-functions-in-javascript</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Indra</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-34447</link>
		<dc:creator>Indra</dc:creator>
		<pubDate>Wed, 26 Oct 2011 16:17:40 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-34447</guid>
		<description>Thanks for this superb example. I have a question thou, if I wanted to stop an audio element from looping (after setting the loop from addEventListener) how would I do that? I tried removeEventListener with no luck (the event listener does not get removed at all) (chrome  14/ firefox 7)...</description>
		<content:encoded><![CDATA[<p>Thanks for this superb example. I have a question thou, if I wanted to stop an audio element from looping (after setting the loop from addEventListener) how would I do that? I tried removeEventListener with no luck (the event listener does not get removed at all) (chrome  14/ firefox 7)&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-34240</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sat, 15 Oct 2011 19:38:53 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-34240</guid>
		<description>Method 2 loops fine for me in Firefox 7 on WinXP. The slight delay is almost unnoticeable.

I also added &#039;autoplay&#039; to the list of options after &#039;controls&#039; and &#039;preload&#039;. 

Thanks for the examples!

Of course none of this would be necessary if Firefox would support the loop option in HTML5.</description>
		<content:encoded><![CDATA[<p>Method 2 loops fine for me in Firefox 7 on WinXP. The slight delay is almost unnoticeable.</p>
<p>I also added &#8216;autoplay&#8217; to the list of options after &#8216;controls&#8217; and &#8216;preload&#8217;. </p>
<p>Thanks for the examples!</p>
<p>Of course none of this would be necessary if Firefox would support the loop option in HTML5.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Caine</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-32309</link>
		<dc:creator>Caine</dc:creator>
		<pubDate>Thu, 18 Aug 2011 18:11:19 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-32309</guid>
		<description>I&#039;ve tried method 2 but it&#039;s not looping in FF6 on Linux Mint 9. What gives?</description>
		<content:encoded><![CDATA[<p>I&#8217;ve tried method 2 but it&#8217;s not looping in FF6 on Linux Mint 9. What gives?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joe</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-31969</link>
		<dc:creator>joe</dc:creator>
		<pubDate>Thu, 11 Aug 2011 11:09:16 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-31969</guid>
		<description>is it not working at all on safari (osx 10.6, safari 5.1)? weird.</description>
		<content:encoded><![CDATA[<p>is it not working at all on safari (osx 10.6, safari 5.1)? weird.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-29939</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 24 Jun 2011 08:05:52 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-29939</guid>
		<description>That makes me feel wonderful. :)

Oh and lots of juicy information. Good read.

Thanks!</description>
		<content:encoded><![CDATA[<p>That makes me feel wonderful. <img src='http://forestmist.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Oh and lots of juicy information. Good read.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Giuca</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/comment-page-1/#comment-29903</link>
		<dc:creator>Matt Giuca</dc:creator>
		<pubDate>Thu, 23 Jun 2011 05:09:40 +0000</pubDate>
		<guid isPermaLink="false">http://forestmist.org/?p=1102#comment-29903</guid>
		<description>Thanks very much for writing this article, Daniel (which at this point seems to be the primary resource for looping in HTML5!)

I read the discussion on Mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=654787 (posted by @Hay who commented above). The conclusion I can draw from that discussion is that your Loop Method 1 would be great if browsers supported it (but FF still doesn&#039;t to this day). Loop Methods 2 and 3 work, but *can never be* seamless.

Basically, if Loop Method 1 was supported, then the browser implementor would be able to program it to loop seamlessly by buffering the data from the start of the track in advance and having it loop seamlessly (down to the sample level).

With Methods 2 and 3 (where JavaScript is involved), at the very best you will have to wait until the audio buffer clears and start a new buffer. But it&#039;s much worse than that, because what is going to happen when the audio ends is that it pushes a new event handler on the browser&#039;s main event loop, waits for the event loop to pump again, executes some JavaScript code, which then starts up the audio system again. So the seamlessness of those approaches will vary from browser to browser and from system to system, but it will never actually be seamless. Also I wouldn&#039;t expect there to be any real difference between Methods 2 and 3.

So I&#039;d stick with Method 2 for now (and not expect seamless playback), and go over to Method 1 when browsers are ready. One suggestion (http://stackoverflow.com/questions/3273552/html-5-audio-looping) is to check whether typeof new Audio().loop == &#039;boolean&#039;, which will tell you whether the browser supports Method 1. If so, use that. If not, fall back to Method 2.</description>
		<content:encoded><![CDATA[<p>Thanks very much for writing this article, Daniel (which at this point seems to be the primary resource for looping in HTML5!)</p>
<p>I read the discussion on Mozilla bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=654787" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=654787</a> (posted by @Hay who commented above). The conclusion I can draw from that discussion is that your Loop Method 1 would be great if browsers supported it (but FF still doesn&#8217;t to this day). Loop Methods 2 and 3 work, but *can never be* seamless.</p>
<p>Basically, if Loop Method 1 was supported, then the browser implementor would be able to program it to loop seamlessly by buffering the data from the start of the track in advance and having it loop seamlessly (down to the sample level).</p>
<p>With Methods 2 and 3 (where JavaScript is involved), at the very best you will have to wait until the audio buffer clears and start a new buffer. But it&#8217;s much worse than that, because what is going to happen when the audio ends is that it pushes a new event handler on the browser&#8217;s main event loop, waits for the event loop to pump again, executes some JavaScript code, which then starts up the audio system again. So the seamlessness of those approaches will vary from browser to browser and from system to system, but it will never actually be seamless. Also I wouldn&#8217;t expect there to be any real difference between Methods 2 and 3.</p>
<p>So I&#8217;d stick with Method 2 for now (and not expect seamless playback), and go over to Method 1 when browsers are ready. One suggestion (<a href="http://stackoverflow.com/questions/3273552/html-5-audio-looping" rel="nofollow">http://stackoverflow.com/questions/3273552/html-5-audio-looping</a>) is to check whether typeof new Audio().loop == &#8216;boolean&#8217;, which will tell you whether the browser supports Method 1. If so, use that. If not, fall back to Method 2.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

