зеркало из https://github.com/mozilla/popcorn-js.git
Added demo for ticket 66
This commit is contained in:
Родитель
cc37987e92
Коммит
30e1fcc86f
|
@ -0,0 +1,95 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Popcorn Twitter Video Demo</title>
|
||||
<script src="../../popcorn.js"></script>
|
||||
<script src="../../players/youtube/popcorn.youtube.js"></script>
|
||||
<script src="../../players/vimeo/popcorn.vimeo.js"></script>
|
||||
<script src="../../plugins/twitter/popcorn.twitter.js"></script>
|
||||
<script>
|
||||
var count = 0;
|
||||
function btnClick(){
|
||||
var popcorn, ok = false;
|
||||
|
||||
// Anytime after the first click, remove the current video and
|
||||
// wipe the current twitter feed
|
||||
if(count != 0){
|
||||
// Popcorn.removePlugin(popcorn, twitter);
|
||||
popcorn = "";
|
||||
document.getElementById('twitterdiv').innerHTML = "";
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
// If statements parsing URL entered in the textbox, checking for keywords
|
||||
// and displaying the video accordingly, displays error message if the
|
||||
// video type is incompatable
|
||||
if( document.getElementById( 'vidUrl' ).value.search( "youtube" ) != -1 ){
|
||||
popcorn = Popcorn( Popcorn.youtube( 'video', document.getElementById( 'vidUrl' ).value ) );
|
||||
ok = true;
|
||||
}
|
||||
else if( document.getElementById( 'vidUrl' ).value.search( "vimeo" ) != -1 ){
|
||||
popcorn = Popcorn( Popcorn.vimeo( 'video', document.getElementById( 'vidUrl' ).value ) );
|
||||
ok = true;
|
||||
}
|
||||
else if( document.getElementById( 'vidUrl' ).value.search( "ogv" ) != -1 ){
|
||||
document.getElementById( 'video' ).innerHTML =
|
||||
"<video id='video2'" +
|
||||
"controls autoplay" +
|
||||
"width= '250px'>" +
|
||||
|
||||
"<source id='ogv'" +
|
||||
"type='video/ogg; codecs=\"theora, vorbis\"'>" +
|
||||
|
||||
"</video>";
|
||||
document.getElementById( 'ogv' ).src = document.getElementById( 'vidUrl' ).value;
|
||||
popcorn = Popcorn( '#video2' );
|
||||
ok = true;
|
||||
}
|
||||
else if(document.getElementById( 'vidUrl' ).value.search( "mp4" ) != -1){
|
||||
document.getElementById( 'video' ).innerHTML =
|
||||
"<video id='video2'" +
|
||||
"controls autoplay" +
|
||||
"width= '250px'>" +
|
||||
|
||||
"<source id='mp4'" +
|
||||
"type='video/mp4; codecs=\"avc1, mp4a\"'>" +
|
||||
|
||||
"</video>";
|
||||
document.getElementById( 'mp4' ).src = document.getElementById( 'vidUrl' ).value;
|
||||
popcorn = Popcorn( '#video2' );
|
||||
ok = true;
|
||||
}
|
||||
else{
|
||||
document.getElementById( 'video' ).innerHTML = "</br><b>The link is not a supported video type</b>";
|
||||
}
|
||||
|
||||
if(ok){
|
||||
popcorn = popcorn
|
||||
.twitter({
|
||||
start: 0, // seconds
|
||||
end: 45, // seconds
|
||||
src: document.getElementById( 'hashtag' ).value,
|
||||
target: 'twitterdiv'
|
||||
})
|
||||
.volume(0)
|
||||
.play();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h3>Twitter Hashtag video demo</h3>
|
||||
<p>Insert a link to a video(youtube,vimeo,.ogv,or.mp4) and supply a hashtag</p>
|
||||
<div>
|
||||
<p>Video URL:</p>
|
||||
<input id="vidUrl" size="50" value="http://www.youtube.com/watch?v=9oar9glUCL0"/><br />
|
||||
<p>Twitter Hashtag:</p>
|
||||
<input id="hashtag" size="20" value="#seneca"/>
|
||||
<button class="start" id="srtBtn" onClick="btnClick();">Play</button><br />
|
||||
<div id="video" width="360" height="300" ></div><br />
|
||||
<div id="twitterdiv" style="position:relative;float:left;width:400px;height:600px"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Загрузка…
Ссылка в новой задаче