Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
swdev:js:javascript_code_snippets [2016/05/20 10:03]
smayr [Audio Support]
swdev:js:javascript_code_snippets [2018/02/09 14:07] (current)
smayr
Line 37: Line 37:
 </code> </code>
 == Query Touch Device == == Query Touch Device ==
-<code html file sample.php>+File ''sample.php'': 
 +<code html >
 <html> <html>
 ... ...
Line 69: Line 70:
 </code> </code>
  
-<code javascript file utils.js>+File ''utils.js'': 
 +<code javascript>
 //------------------------------------------------------------------------ //------------------------------------------------------------------------
 // Test whether client device supports touch.   // Test whether client device supports touch.  
Line 97: Line 99:
  
 Preload audio clips and play them.  Add the following to a webpage: Preload audio clips and play them.  Add the following to a webpage:
-<code html>+<code php>
 <html> <html>
 <head> <head>
Line 132: Line 134:
 <div class="col-lg-6"> <div class="col-lg-6">
   <h4>Audio</h4>   <h4>Audio</h4>
-  <p>An audio clip</p>+  <p>A preloaded audio clip, ready to play</p>
   <audio controls preload="auto">   <audio controls preload="auto">
     <source src="audio/audio1.wav" type="audio/wav">     <source src="audio/audio1.wav" type="audio/wav">
Line 139: Line 141:
     Your browser does not support the audio element.     Your browser does not support the audio element.
   </audio>   </audio>
 +  <p>An autoplay clip</p>
 +  <audio src="1.wav" autoplay></audio>
 </div> </div>
 </code> </code>
  
 Source:  Source: 
-  * [[http://html5doctor.com/native-audio-in-the-browser/|Native Audio in the Browser]]+  * [[http://html5doctor.com/native-audio-in-the-browser|HTML5 Doctor: Native Audio in the Browser]] 
 +  * [[http://html5doctor.com/html5-audio-the-state-of-play|HTML5 Doctor: Audio, the State of Play]]
   * [[http://happyworm.com/jquery/jplayer|JPlayer (Open Source)]]   * [[http://happyworm.com/jquery/jplayer|JPlayer (Open Source)]]