mirror of
https://github.com/videojs/video.js.git
synced 2024-11-24 08:42:25 +02:00
Made src() update URL to absolute also.
This commit is contained in:
parent
c714781aef
commit
e4723240b6
13
src/lib.js
13
src/lib.js
@ -282,9 +282,16 @@ _V_.extend({
|
|||||||
// Get abosolute version of relative URL. Used to tell flash correct URL.
|
// 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
|
// http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue
|
||||||
getAbsoluteURL: function(url){
|
getAbsoluteURL: function(url){
|
||||||
return _V_.createElement('div', {
|
|
||||||
innerHTML: '<a href="'+url+'">x</a>'
|
// Check if absolute URL
|
||||||
}).firstChild.href;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
15
src/tech.js
15
src/tech.js
@ -301,17 +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(_V_.getAbsoluteURL(source.src));
|
||||||
// Check if absolute URL
|
|
||||||
var tempSrc = source.src;
|
|
||||||
if (!tempSrc.match(/^https?:\/\//)) {
|
|
||||||
// Convert to absolute URL. Flash hosted off-site needs an absolute URL.
|
|
||||||
tempSrc = _V_.getAbsoluteURL(tempSrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
_V_.log(tempSrc)
|
|
||||||
|
|
||||||
flashVars.src = encodeURIComponent(tempSrc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add placeholder to player div
|
// Add placeholder to player div
|
||||||
@ -471,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.
|
||||||
|
Loading…
Reference in New Issue
Block a user