Merge for new source api changes

This commit is contained in:
Sam Potts
2016-01-14 09:53:58 +11:00
parent e6c30ec137
commit cce7e9932e
3 changed files with 34 additions and 5 deletions

View File

@ -1930,6 +1930,35 @@
}
}
// Add common function to retrieve media source
function _source(source) {
// If not null or undefined, parse it
if(typeof source !== 'undefined') {
_updateSource(source);
return;
}
// Return the current source
var url;
switch(plyr.type) {
case 'youtube':
url = plyr.embed.getVideoUrl();
break;
case 'vimeo':
plyr.embed.api('getVideoUrl', function (value) {
url = value;
});
break;
default:
url = plyr.media.currentSrc;
break;
}
return url || '';
}
// Update source
// Sources are not checked for support so be careful
function _updateSource(source) {
@ -2394,7 +2423,7 @@
rewind: _rewind,
forward: _forward,
seek: _seek,
source: _updateSource,
source: _source,
poster: _updatePoster,
setVolume: _setVolume,
togglePlay: _togglePlay,