Created
November 3, 2013 19:00
-
-
Save anonymous/7293594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div> | |
<audio id="my-audio"> | |
<source src="http://jPlayer.org/audio/mp3/Miaow-07-Bubble.mp3" > | |
<source src="http://jPlayer.org/audio/ogg/Miaow-07-Bubble.ogg" > | |
<!-- place fallback here as <audio> supporting browsers will ignore it --> | |
<a href="http://jPlayer.org/audio/ogg/Miaow-07-Bubble.ogg">http://jPlayer.org/audio/ogg/Miaow-07-Bubble.ogg</a> | |
</audio> | |
<a id="audio-play" href="#">play</a> | |
<a id="audio-pause" href="#">pause</a> | |
</div> | |
<div> | |
<video id="my-video" width="480" height="270" poster="http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png"> | |
<source src="http://jPlayer.org/video/webm/Big_Buck_Bunny_Trailer.webm " > | |
<source src="http://jPlayer.org/video/ogv/Big_Buck_Bunny_Trailer.ogv" > | |
<source src="http://jPlayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v " > | |
<!-- place fallback here as <audio> supporting browsers will ignore it --> | |
<a href="http://jPlayer.org/video/ogv/Big_Buck_Bunny_Trailer.ogv">http://jPlayer.org/video/ogv/Big_Buck_Bunny_Trailer.ogv</a> | |
</video> | |
<a id="video-play" href="#">play</a> | |
<a id="video-pause" href="#">pause</a> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload=function(){ | |
var myAudio = document.getElementById('my-audio'); | |
var audioplay = document.getElementById('audio-play'); | |
var audiopause = document.getElementById('audio-pause'); | |
// refer to the functions below | |
function playAudio() { | |
myAudio.play(); | |
return false; | |
} | |
function pauseAudio() { | |
myAudio.pause(); | |
return false; | |
} | |
audioplay.onclick = playAudio; | |
audiopause.onclick = pauseAudio; | |
var myVideo = document.getElementById('my-video'); | |
var videoplay = document.getElementById('video-play'); | |
var videopause = document.getElementById('video-pause'); | |
// refer to the functions below | |
function playVideo() { | |
myVideo.play(); | |
return false; | |
} | |
function pauseVideo() { | |
myVideo.pause(); | |
return false; | |
} | |
videoplay.onclick = playVideo; | |
videopause.onclick = pauseVideo; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment