diff --git a/www/js/callbacks.js b/www/js/callbacks.js index fcd5c7d6..8560c8e7 100644 --- a/www/js/callbacks.js +++ b/www/js/callbacks.js @@ -859,11 +859,10 @@ Callbacks = { and unwilling to compromise on the issue. */ if (NO_VIMEO && data.type === "vi" && data.meta.direct) { + data.type = "fi"; // For browsers that don't support native h264 playback if (USEROPTS.no_h264) { - data.type = "fl"; - } else { - data.type = "rv"; + data.forceFlash = true; } /* Convert youtube-style quality key to vimeo workaround quality */ @@ -895,6 +894,8 @@ Callbacks = { if (data.type === "rt") { data.url = data.id; + data.type = "fi"; + data.forceFlash = true; } if(data.type != PLAYER.type) { diff --git a/www/js/player.js b/www/js/player.js index 12271e9d..d63fd456 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -800,98 +800,6 @@ function flashEventHandler(id, ev, data) { } } -var FlashPlayer = function (data) { - removeOld(); - var self = this; - self.volume = VOLUME; - self.videoId = data.id; - self.videoUrl = data.url; - self.videoLength = data.seconds; - self.paused = false; - self.currentTime = 0; - - self.init = function () { - var params = { - allowFullScreen: "true", - allowScriptAccess: "always", - allowNetworking: "all", - wMode: "direct" - }; - - var flashvars = { - src: encodeURIComponent(self.videoUrl), - // For some reason this param seems not to work - clipStartTime: Math.floor(data.currentTime), - javascriptCallbackFunction: "flashEventHandler", - autoPlay: true, - volume: VOLUME - }; - - if (self.videoUrl.indexOf("rtmp") === 0) { - flashvars.streamType = "live"; - } else { - flashvars.streamType = "recorded"; - } - - swfobject.embedSWF("/StrobeMediaPlayback.swf", - "ytapiplayer", - VWIDTH, VHEIGHT, - "10.1.0", - null, - flashvars, - params, - { name: "ytapiplayer" } - ); - - self.player = $("#ytapiplayer")[0]; - }; - - self.load = function (data) { - self.videoId = data.id; - self.videoUrl = data.url; - self.videoLength = data.seconds; - self.init(); - }; - - self.pause = function () { - if (self.player && self.player.pause) - self.player.pause(); - }; - - self.play = function () { - // Why is it play2? What happened to play1? - if (self.player && self.player.play2) - self.player.play2(); - }; - - self.isPaused = function (cb) { - cb(self.paused); - }; - - self.getTime = function (cb) { - cb(self.currentTime); - }; - - self.seek = function (to) { - if (self.player && self.player.seek) { - self.player.seek(Math.floor(to)); - } - }; - - self.getVolume = function (cb) { - cb(self.volume); - }; - - self.setVolume = function (vol) { - if (self.player && self.player.setVolume) - self.player.setVolume(vol); - }; - - waitUntilDefined(window, "swfobject", function () { - self.init(); - }); -}; - var JWPlayer = function (data) { var self = this; self.videoId = data.id; @@ -1161,8 +1069,89 @@ var GoogleDocsPlayer = function (data) { self.init(data); }; -function RawVideoPlayer(data) { +function FilePlayer(data) { var self = this; + + self.initFlash = function (data) { + waitUntilDefined(window, "swfobject", function () { + self.volume = VOLUME; + self.videoId = data.id; + self.videoURL = data.url; + self.videoLength = data.seconds; + self.paused = false; + self.currentTime = 0; + + var params = { + allowFullScreen: "true", + allowScriptAccess: "always", + allowNetworking: "all", + wMode: "direct" + }; + + var flashvars = { + src: encodeURIComponent(self.videoURL), + // For some reason this param seems not to work + clipStartTime: Math.floor(data.currentTime), + javascriptCallbackFunction: "flashEventHandler", + autoPlay: true, + volume: VOLUME + }; + + if (self.videoURL.indexOf("rtmp") === 0) { + flashvars.streamType = "live"; + } else { + flashvars.streamType = "recorded"; + } + + swfobject.embedSWF("/StrobeMediaPlayback.swf", + "ytapiplayer", + VWIDTH, VHEIGHT, + "10.1.0", + null, + flashvars, + params, + { name: "ytapiplayer" } + ); + + self.player = $("#ytapiplayer")[0]; + resizeStuff(); + + self.pause = function () { + if (self.player && self.player.pause) + self.player.pause(); + }; + + self.play = function () { + // Why is it play2? What happened to play1? + if (self.player && self.player.play2) + self.player.play2(); + }; + + self.isPaused = function (cb) { + cb(self.paused); + }; + + self.getTime = function (cb) { + cb(self.currentTime); + }; + + self.seek = function (to) { + if (self.player && self.player.seek) { + self.player.seek(Math.floor(to)); + } + }; + + self.getVolume = function (cb) { + cb(self.volume); + }; + + self.setVolume = function (vol) { + if (self.player && self.player.setVolume) + self.player.setVolume(vol); + }; + }); + }; + self.init = function (data) { self.videoId = data.id; self.videoURL = data.url; @@ -1175,12 +1164,14 @@ function RawVideoPlayer(data) { .html("Your browser does not support HTML5 <video> tags :("); video.error(function (err) { setTimeout(function () { - fallbackRaw(data); + console.log("