Essai
Un article de GrandTerrier.
(Différences entre les versions)
Version du 28 janvier ~ genver 2018 à 09:43 (modifier) GdTerrier (Discuter | contributions) ← Différence précédente |
Version du 28 janvier ~ genver 2018 à 10:02 (modifier) (undo) GdTerrier (Discuter | contributions) Différence suivante → |
||
Ligne 24: | Ligne 24: | ||
<source src="http://www.grandterrier.net/wiki/files/LesNaufrageursBrabant4.mp4" type="video/mp4"> | <source src="http://www.grandterrier.net/wiki/files/LesNaufrageursBrabant4.mp4" type="video/mp4"> | ||
Your browser does not support the video tag or the file format of this video. | Your browser does not support the video tag or the file format of this video. | ||
- | </video></addhtml> | + | </video> |
+ | |||
+ | <video id="videos" width="420"> | ||
+ | <source src="http://www.grandterrier.net/wiki/files/LesNaufrageursBrabant1.mp4" type="video/mp4"> | ||
+ | <source type="video/mp3"> | ||
+ | <source type="video/ogg"> | ||
+ | Your browser does not support HTML5 video. | ||
+ | </video> | ||
+ | <br> | ||
+ | <button onclick="prevButton()">Prev</button> | ||
+ | <button onclick="playPause()">Play/Pause</button> | ||
+ | <button onclick="nextButton()">Next</button> | ||
+ | </div> | ||
+ | <script> | ||
+ | var myVideo=document.getElementById("videos"); | ||
+ | var videoList=[http://www.grandterrier.net/wiki/files/LesNaufrageursBrabant1.mp4','http://www.grandterrier.net/wiki/files/LesNaufrageursBrabant2.mp4','http://www.grandterrier.net/wiki/files/LesNaufrageursBrabant3.mp4','http://www.grandterrier.net/wiki/files/LesNaufrageursBrabant4.mp4']; | ||
+ | var index = videoList.indexOf(window.currentVideoName); | ||
+ | //Next button | ||
+ | function nextButton(){ | ||
+ | myVideo.pause(); | ||
+ | myVideo.currentTime=0; | ||
+ | index = index + 1; | ||
+ | if(index==videoList.length) | ||
+ | index = 0; | ||
+ | alert(videoList[index]); | ||
+ | myVideo.src = 'video/'+videoList[index]; | ||
+ | window.currentVideoName=videoList[index]; | ||
+ | myVideo.play(); | ||
+ | } | ||
+ | //Prev button | ||
+ | function prevButton(){ | ||
+ | myVideo.pause(); | ||
+ | myVideo.currentTime=0; | ||
+ | index = index - 1; | ||
+ | if(index<0) | ||
+ | index = videoList.length; | ||
+ | alert(videoList[index]); | ||
+ | myVideo.src = 'video/'+videoList[index]; | ||
+ | window.currentVideoName=videoList[index]; | ||
+ | myVideo.play(); | ||
+ | } | ||
+ | function playPause() | ||
+ | { | ||
+ | if (myVideo.paused) | ||
+ | myVideo.play(); | ||
+ | else | ||
+ | myVideo.pause(); | ||
+ | } | ||
+ | </script> | ||
+ | </addhtml> |