1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-25 11:13:52 +02:00

Merge branch 'bugfix/src-getter' of git://github.com/dmlap/video-js into dmlap-bugfix/src-getter

Conflicts:
	src/js/media/flash.js
This commit is contained in:
Steve Heffernan 2014-03-04 11:24:10 -08:00
commit 7c772fbf3e
5 changed files with 25 additions and 5 deletions

View File

@ -5,6 +5,7 @@ CHANGELOG
* Added component(1) support ([view](https://github.com/videojs/video.js/pull/1032))
* Captions now move down when controls are hidden ([view](https://github.com/videojs/video.js/pull/1053))
* Added the .less source file to the distribution files ([view](https://github.com/videojs/video.js/pull/1056))
* Changed src() to return the current selected source ([view](https://github.com/videojs/video.js/pull/968))
--------------------

View File

@ -258,12 +258,15 @@ vjs.Flash.prototype.pause = function(){
};
vjs.Flash.prototype.src = function(src){
if (src === undefined) {
return this.currentSrc();
}
if (vjs.Flash.isStreamingSrc(src)) {
src = vjs.Flash.streamToParts(src);
this.setRtmpConnection(src.connection);
this.setRtmpStream(src.stream);
}
else {
} else {
// Make sure source URL is abosolute.
src = vjs.getAbsoluteURL(src);
this.el_.vjs_src(src);
@ -318,8 +321,8 @@ vjs.Flash.prototype.enterFullScreen = function(){
// Create setters and getters for attributes
var api = vjs.Flash.prototype,
readWrite = 'rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted'.split(','),
readOnly = 'error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks'.split(',');
// Overridden: buffered, currentTime
readOnly = 'error,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks'.split(',');
// Overridden: buffered, currentTime, currentSrc
/**
* @this {*}

View File

@ -1019,9 +1019,14 @@ vjs.Player.prototype.selectSource = function(sources){
* ]);
*
* @param {String|Object|Array=} source The source URL, object, or array of sources
* @return {vjs.Player} self
* @return {String} The current video source when getting
* @return {String} The player when setting
*/
vjs.Player.prototype.src = function(source){
if (source === undefined) {
return this.techGet('src');
}
// Case: Array of source objects to choose from and pick the best to play
if (source instanceof Array) {
@ -1074,6 +1079,7 @@ vjs.Player.prototype.src = function(source){
}
}
}
return this;
};

View File

@ -36,6 +36,7 @@ vjs.MediaFaker.prototype['setPoster'] = function(val){ this.el().poster = val; }
vjs.MediaFaker.prototype.currentTime = function(){ return 0; };
vjs.MediaFaker.prototype.seeking = function(){ return false; };
vjs.MediaFaker.prototype.src = function(){ return 'movie.mp4'; };
vjs.MediaFaker.prototype.volume = function(){ return 0; };
vjs.MediaFaker.prototype.muted = function(){ return false; };
vjs.MediaFaker.prototype.pause = function(){ return false; };

View File

@ -357,6 +357,15 @@ test('should use custom message when encountering an unsupported video type',
player.dispose();
});
test('should return the player when setting src', function() {
var player, ret;
player = PlayerTest.makePlayer({}),
ret = player.src('foo');
equal(player, ret, 'the player is returned');
});
test('should register players with generated ids', function(){
var fixture, video, player, id;
fixture = document.getElementById('qunit-fixture');