mirror of
https://github.com/videojs/video.js.git
synced 2025-07-15 01:34:23 +02:00
Updated swf code to auto play on new src.
This commit is contained in:
@ -75,7 +75,6 @@ _V_.Player = _V_.Component.extend({
|
|||||||
this.addEvent("pause", this.onPause);
|
this.addEvent("pause", this.onPause);
|
||||||
this.addEvent("error", this.onError);
|
this.addEvent("error", this.onError);
|
||||||
|
|
||||||
|
|
||||||
// When the API is ready, loop through the components and add to the player.
|
// When the API is ready, loop through the components and add to the player.
|
||||||
if (this.options.controls) {
|
if (this.options.controls) {
|
||||||
this.ready(function(){
|
this.ready(function(){
|
||||||
@ -443,7 +442,6 @@ _V_.Player.prototype.extend({
|
|||||||
// Turn on fullscreen (or window) mode
|
// Turn on fullscreen (or window) mode
|
||||||
enterFullScreen: function(){
|
enterFullScreen: function(){
|
||||||
if (this.supportsFullScreen()) {
|
if (this.supportsFullScreen()) {
|
||||||
this.videoIsFullScreen = true;
|
|
||||||
this.apiCall("enterFullScreen");
|
this.apiCall("enterFullScreen");
|
||||||
} else {
|
} else {
|
||||||
this.enterFullWindow();
|
this.enterFullWindow();
|
||||||
@ -453,10 +451,7 @@ _V_.Player.prototype.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
exitFullScreen: function(){
|
exitFullScreen: function(){
|
||||||
if (this.supportsFullScreen()) {
|
if (true || !this.supportsFullScreen()) {
|
||||||
this.videoIsFullScreen = false;
|
|
||||||
this.apiCall("exitFullScreen");
|
|
||||||
} else {
|
|
||||||
this.exitFullWindow();
|
this.exitFullWindow();
|
||||||
}
|
}
|
||||||
this.triggerEvent("exitFullScreen");
|
this.triggerEvent("exitFullScreen");
|
||||||
@ -569,7 +564,7 @@ _V_.Player.prototype.extend({
|
|||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
if (this.options.autoplay) {
|
if (this.options.autoplay) {
|
||||||
// this.play();
|
this.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
src/tech.js
33
src/tech.js
@ -20,7 +20,7 @@ _V_.PlaybackTech = _V_.Component.extend({
|
|||||||
|
|
||||||
// Create placeholder methods for each that warn when a method
|
// Create placeholder methods for each that warn when a method
|
||||||
// isn't supported by the current playback technology
|
// isn't supported by the current playback technology
|
||||||
_V_.apiMethods = "play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,exitFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(",");
|
_V_.apiMethods = "play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(",");
|
||||||
_V_.each(_V_.apiMethods, function(methodName){
|
_V_.each(_V_.apiMethods, function(methodName){
|
||||||
_V_.PlaybackTech.prototype[methodName] = function(){
|
_V_.PlaybackTech.prototype[methodName] = function(){
|
||||||
throw new Error("The '"+method+"' method is not available on the playback technology's API");
|
throw new Error("The '"+method+"' method is not available on the playback technology's API");
|
||||||
@ -135,29 +135,15 @@ _V_.HTML5 = _V_.PlaybackTech.extend({
|
|||||||
height: function(){ return this.el.offsetHeight; },
|
height: function(){ return this.el.offsetHeight; },
|
||||||
|
|
||||||
supportsFullScreen: function(){
|
supportsFullScreen: function(){
|
||||||
if (typeof this.el.webkitRequestFullScreen == 'function') {
|
if(typeof this.el.webkitEnterFullScreen == 'function') {
|
||||||
return true;
|
|
||||||
} else if (typeof this.el.webkitEnterFullScreen == 'function') {
|
|
||||||
|
|
||||||
// Seems to be broken in Chromium/Chrome && Safari in Leopard
|
// Seems to be broken in Chromium/Chrome && Safari in Leopard
|
||||||
if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) {
|
if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
enterFullScreen: function(){
|
enterFullScreen: function(){
|
||||||
if (typeof this.el.webkitRequestFullScreen == 'function') {
|
|
||||||
try {
|
|
||||||
this.player.el.webkitRequestFullScreen();
|
|
||||||
} catch (e) {
|
|
||||||
if (e.code == 11) {
|
|
||||||
// this.warning(VideoJS.warnings.videoNotReady);
|
|
||||||
_V_.log("VideoJS: Video not ready.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
try {
|
||||||
this.el.webkitEnterFullScreen();
|
this.el.webkitEnterFullScreen();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -166,15 +152,6 @@ _V_.HTML5 = _V_.PlaybackTech.extend({
|
|||||||
_V_.log("VideoJS: Video not ready.")
|
_V_.log("VideoJS: Video not ready.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
exitFullScreen: function(){
|
|
||||||
if (typeof this.el.webkitRequestFullScreen == 'function') {
|
|
||||||
document.webkitCancelFullScreen();
|
|
||||||
} else {
|
|
||||||
document.webkitExitFullScreen();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
src: function(src){ this.el.src = src; },
|
src: function(src){ this.el.src = src; },
|
||||||
load: function(){ this.el.load(); },
|
load: function(){ this.el.load(); },
|
||||||
@ -316,8 +293,8 @@ _V_.H5swf = _V_.PlaybackTech.extend({
|
|||||||
// Currently the SWF doesn't autoplay if you load a source later.
|
// Currently the SWF doesn't autoplay if you load a source later.
|
||||||
// e.g. Load player w/ no source, wait 2s, set src.
|
// e.g. Load player w/ no source, wait 2s, set src.
|
||||||
if (this.player.autoplay) {
|
if (this.player.autoplay) {
|
||||||
// var tech = this;
|
var tech = this;
|
||||||
// setTimeout(function(){ tech.play(); }, 0);
|
setTimeout(function(){ tech.play(); }, 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
load: function(){ this.el.vjs_load(); },
|
load: function(){ this.el.vjs_load(); },
|
||||||
|
Reference in New Issue
Block a user