Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: test for autoplay Date: Wed, 21 Jan 2015 23:35:07 +0100 Organization: solani.org Lines: 38 Message-ID: References: <2227075.ZdhQdnHKJ3@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: solani.org 1421879702 13874 eJwNyEcBwEAIADBLjGPJYfqX0OYZYUVteyr65OQ82Ar3HOY4wb0oeqyTBheaZCXYAeuPWM0PIRURYA== (21 Jan 2015 22:35:02 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Wed, 21 Jan 2015 22:35:02 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 X-User-ID: eJwNysEBwCAMAsCVjAVSx9Gk7D+CvffxUagSokDTB4WttqLbMdYEXJ/HfisPO5YJbTL7r13zAjM3EfI= In-Reply-To: <2227075.ZdhQdnHKJ3@PointedEars.de> Cancel-Lock: sha1:yrupQMRCxw87/ommU95S08KN2B8= X-NNTP-Posting-Host: eJwFwYEBABAIAMGVUH0ah9L+I7gzYZKuGGpt7XvUdLhHkfe8ohZTlcoby7NHs6JDDjuj+BNVEPE= Xref: csiph.com comp.lang.javascript:26642 Thomas 'PointedEars' Lahn wrote: > Andrew Poulos wrote: > >> $(audio).on('play', function() { >> AUTOPLAY = true; >> }); >> >> Alas I don't understand "$(audio).on('play', function() {" >> >> What is it doing? > > This is the jQuery way of adding an event listener for the “play” event to > the element referred to by “audio”. Apparently the standards-compliant > > audio.onplay = function () { > AUTOPLAY = true; > }; > > was too hard for them :-> I had only found the onplay property of the MediaController interface[1], but have not been able to verify that the HTMLAudioElement interface is supposed to inherit MediaController. Where is that specified? > This code creates an “audio” element in memory (using a proprietary > approach; the standards-compliant approach would be > “document.createElement("audio")”) It seems to me the Audio constructor is specified in the W3C HTML5 Recommendation.[2] [1] [2] -- Christoph M. Becker