1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-27 02:43:45 +02:00

Merge branch 'feature/relative-flash-urls'

This commit is contained in:
Steve Heffernan 2012-02-13 17:14:50 -08:00
commit 168ae2cbe8
3 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,4 @@
* Automatically converting URsource URL to absolute for Flash fallback.
* Created new 'loadedalldata' event for when the source is completely downloaded * Created new 'loadedalldata' event for when the source is completely downloaded
* Improved player.destory(). Now removes elements and references. * Improved player.destory(). Now removes elements and references.
* Refactored API to be more immediately available. * Refactored API to be more immediately available.

View File

@ -277,6 +277,21 @@ _V_.extend({
_V_.log("LocalStorage Error (VideoJS)", e); _V_.log("LocalStorage Error (VideoJS)", e);
} }
} }
},
// Get abosolute version of relative URL. Used to tell flash correct URL.
// http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue
getAbsoluteURL: function(url){
// Check if absolute URL
if (!url.match(/^https?:\/\//)) {
// Convert to absolute URL. Flash hosted off-site needs an absolute URL.
url = _V_.createElement('div', {
innerHTML: '<a href="'+url+'">x</a>'
}).firstChild.href;
}
return url;
} }
}); });

View File

@ -301,7 +301,7 @@ _V_.flash = _V_.PlaybackTech.extend({
// If source was supplied pass as a flash var. // If source was supplied pass as a flash var.
if (source) { if (source) {
flashVars.src = encodeURIComponent(source.src); flashVars.src = encodeURIComponent(_V_.getAbsoluteURL(source.src));
} }
// Add placeholder to player div // Add placeholder to player div
@ -461,6 +461,9 @@ _V_.flash = _V_.PlaybackTech.extend({
play: function(){ this.el.vjs_play(); }, play: function(){ this.el.vjs_play(); },
pause: function(){ this.el.vjs_pause(); }, pause: function(){ this.el.vjs_pause(); },
src: function(src){ src: function(src){
// Make sure source URL is abosolute.
src = _V_.getAbsoluteURL(src);
this.el.vjs_src(src); this.el.vjs_src(src);
// Currently the SWF doesn't autoplay if you load a source later. // Currently the SWF doesn't autoplay if you load a source later.