Permalink
Browse files

Added youtube.html demo file to the build process, removed defunct te…

…ch/youtube.* files
  • Loading branch information...
1 parent ce31d7e commit efb37c1ffeac908a4862fb1986c0502ffa19aa3a @jhurliman committed Mar 21, 2012
Showing with 21 additions and 167 deletions.
  1. +1 −0 build.sh
  2. +20 −0 build/release-files/youtube.html
  3. +0 −20 tech/youtube.html
  4. +0 −147 tech/youtube.js
View
@@ -42,6 +42,7 @@ cp flash/video-js.swf dist/video-js.swf
cp build/release-files/README.md dist/README.md
cp build/release-files/demo.html dist/demo.html
+cp build/release-files/youtube.html dist/youtube.html
cp LGPLv3-LICENSE.txt dist/LGPLv3-LICENSE.txt
java -jar build/lib/yuicompressor-2.4.7.jar dist/video.js -o dist/video.min.js
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Video.js | HTML5 Video Player | YouTube Demo</title>
+
+ <!-- Change URLs to wherever Video.js files will be hosted -->
+ <link href="video-js.css" rel="stylesheet" type="text/css">
+ <!-- video.js must be in the <head> for older IEs to work. -->
+ <script src="video.js"></script>
+
+</head>
+<body>
+
+ <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="360"
+ data-setup='{"techOrder":["youtube","html5"]}'>
+ <source src="http://www.youtube.com/watch?v=qWjzVHG9T1I" type='video/youtube' />
+ </video>
+
+</body>
+</html>
View
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>VideoJS | HTML5 Video Player</title>
-
- <link href="video-js.css" rel="stylesheet" type="text/css">
-
- <!-- video.js must be in the <head> for older IEs to work. -->
- <script src="video.js"></script>
-
-</head>
-<body>
-
- <video id="example_video_1" class="video-js vjs-default-skin" controls width="640" height="264" data-setup='{"techOrder":["youtube","html5"]}'>
- <source src="http://www.youtube.com/watch?v=YjaZNYSt7o0" type='video/youtube'>
- </video>
-
-</body>
-</html>
-
View
@@ -1,147 +0,0 @@
-// Flowplayer API Connector
-VideoJS.tech.youtube = {
- name: "YouTube",
-
- supported: function(){
- // Flash Player 8 or higher
- return true;
- },
- canPlaySource: function(sourceObj){
- return sourceObj.type == "video/youtube";
- },
- supports: {
- format: {},
- event: {
- progress: false,
- timeupdate: false
- }
- },
- init: function(sourceObj){
- var player = this,
- placeHolder = _V_.createElement("div", { id: player.box.id + "_temp_ytswf" }),
- objId = player.box.id+"_youtube_api";
-
- flashvars = {
- },
-
- params = {
- allowScriptAccess: "always",
- wmode: "opaque",
- bgcolor: "#000000"
- },
-
- attributes = {
- id: objId,
- name: objId,
- 'class': 'vjs-tech'
- };
-
- this.addEvent("techready", function(){
- var url = sourceObj.src;
-
- if (url.indexOf("http://") == 0) {
- // Get Youtube ID from URL
- url = url.match(/v=([^&]+)/)[1];
- }
- this.tels.youtube.cueVideoById(url);
- });
-
- player.box.appendChild(placeHolder);
-
- swfobject.embedSWF("http://www.youtube.com/apiplayer?" +
- "version=3&enablejsapi=1&playerapiid=" + objId,
- placeHolder.id, "480", "295", "9", null, null, params, attributes);
- },
- stateChange: function(id, state){
- var player = _V_(id);
-
- if (state == 0) {
- player.triggerEvent("ended");
- } else if (state == 1) {
- player.triggerEvent("play");
- player.triggerEvent("playing");
- } else if (state == 2) {
- player.triggerEvent("pause");
- }
- },
-
- error: function(id, errorCode){
- _V_.log(id, errorCode);
- },
-
- api: {
- setupTriggers: function(){
- this.tels.youtube.addEventListener("onStateChange",
- "(function(state){ _V_.tech.youtube.stateChange('"+this.id+"',state); })");
-
- this.tels.youtube.addEventListener("onError",
- "(function(errorCode){ _V_.tech.youtube.error('"+this.id+"',errorCode); })");
-
- },
-
- play: function(){ this.tels.youtube.playVideo(); },
- pause: function(){ this.tels.youtube.pauseVideo(); },
- paused: function(){
- return this.tels.youtube.getPlayerState() !== 1; // More accurate than isPaused
- },
-
- currentTime: function(){ return this.tels.youtube.getCurrentTime(); },
- setCurrentTime: function(seconds){
- // False blocks seek-ahead.
- this.tels.youtube.seekTo(seconds, true);
- },
-
- duration: function(){
- return this.tels.youtube.getDuration();
- },
-
- buffered: function(){
- var percent = this.tels.youtube.getVideoBytesLoaded() / this.tels.youtube.getVideoBytesTotal(),
- seconds = this.duration() * percent;
- return _V_.createTimeRange(0, seconds);
- },
-
- volume: function(){ return _V_.round(this.tels.youtube.getVolume() / 100, 2); },
- setVolume: function(percentAsDecimal){
- this.tels.youtube.setVolume(parseInt(percentAsDecimal * 100));
-
- // Youtube Doesn't support VolumeChange Events
- this.triggerEvent("volumechange");
- },
- muted: function(){ return this.tels.youtube.isMuted(); },
- setMuted: function(bool){
- if (bool) {
- this.tels.youtube.mute()
- } else {
- this.tels.youtube.unMute()
- }
- },
-
- supportsFullScreen: function(){
- return false; // Flash does not allow fullscreen through javascript
- // Maybe at click listener, and say "click screen".
- },
- enterFullScreen: function(){ this.tels.flowplayer.api.toggleFullscreen(); },
-
- src: function(src){
- this.tels.youtube.cueVideoById(src);
- },
- load: function(){
- // Youtube will autoload?
- }
- }
-};
-
-// YouTube Defined Player Ready Callback
-window.onYouTubePlayerReady = function(playerId) {
- var el = _V_.el(playerId),
- player = el.parentNode.player; // Get player from box
-
- el.player = player;
-
- // Update reference to playback technology element
- player.tels.youtube = el;
-
- player.triggerEvent("techready");
-}
-

0 comments on commit efb37c1

Please sign in to comment.