1
0
mirror of https://github.com/videojs/video.js.git synced 2025-04-07 07:19:54 +02:00

Merge branch 'stable'

Conflicts:
	dist/video-js/video-js.css
	dist/video-js/video-js.min.css
	dist/video-js/video-js.swf
	dist/video-js/video.dev.js
	dist/video-js/video.js
This commit is contained in:
heff 2015-01-23 10:50:49 -08:00
commit 2489cc1c10
15 changed files with 212 additions and 21 deletions

View File

@ -17,6 +17,14 @@ CHANGELOG
--------------------
## 4.11.4 (2015-01-23)
* @heff exported missing source handler functions ([view](https://github.com/videojs/video.js/pull/1787))
* @heff fixed type support checking for an empty src string ([view](https://github.com/videojs/video.js/pull/1797))
* @carpasse fixed a bug in updating child indexes after removing components ([view](https://github.com/videojs/video.js/pull/1814))
* @dmlap fixed a bug where native controls would show after switching techs ([view](https://github.com/videojs/video.js/pull/1811))
* @H1D fixed an issue with file extension type detection ([view](https://github.com/videojs/video.js/pull/1818))
* @bclwhitaker updated to v4.5.3 of video-js-swf ([view](https://github.com/videojs/video.js/pull/1823))
## 4.11.3 (2014-12-19)
* @gdkraus fixed a bug where you could no longer tab-navigate passed a menu button ([view](https://github.com/videojs/video.js/pull/1760))
* @matteos exported the setSource functions so source handlers will work in the minified version ([view](https://github.com/videojs/video.js/pull/1753))

View File

@ -1,7 +1,7 @@
{
"name": "video.js",
"description": "An HTML5 and Flash video player with a common API and skin for both.",
"version": "4.11.3",
"version": "4.11.4",
"main": [
"dist/video-js/video.js",
"dist/video-js/video-js.css",

View File

@ -1,7 +1,7 @@
{
"name": "video.js",
"description": "An HTML5 and Flash video player with a common API and skin for both.",
"version": "4.11.3",
"version": "4.11.4",
"keywords": [
"videojs",
"html5",

26
dist/video-js/lang/ca.js vendored Normal file
View File

@ -0,0 +1,26 @@
videojs.addLanguage("ca",{
"Play": "Reproducció",
"Pause": "Pausa",
"Current Time": "Temps reproduït",
"Duration Time": "Durada total",
"Remaining Time": "Temps restant",
"Stream Type": "Tipus de seqüència",
"LIVE": "EN DIRECTE",
"Loaded": "Carregat",
"Progress": "Progrés",
"Fullscreen": "Pantalla completa",
"Non-Fullscreen": "Pantalla no completa",
"Mute": "Silencia",
"Unmuted": "Amb so",
"Playback Rate": "Velocitat de reproducció",
"Subtitles": "Subtítols",
"subtitles off": "Subtítols desactivats",
"Captions": "Llegendes",
"captions off": "Llegendes desactivades",
"Chapters": "Capítols",
"You aborted the video playback": "Heu interromput la reproducció del vídeo.",
"A network error caused the video download to fail part-way.": "Un error de la xarxa ha interromput la baixada del vídeo.",
"The video could not be loaded, either because the server or network failed or because the format is not supported.": "No s'ha pogut carregar el vídeo perquè el servidor o la xarxa han fallat, o bé perquè el seu format no és compatible.",
"The video playback was aborted due to a corruption problem or because the video used features your browser did not support.": "La reproducció de vídeo s'ha interrumput per un problema de corrupció de dades o bé perquè el vídeo demanava funcions que el vostre navegador no ofereix.",
"No compatible source was found for this video.": "No s'ha trobat cap font compatible amb el vídeo."
});

26
dist/video-js/lang/cs.js vendored Normal file
View File

@ -0,0 +1,26 @@
videojs.addLanguage("cs",{
"Play": "Přehrát",
"Pause": "Pauza",
"Current Time": "Aktuální čas",
"Duration Time": "Doba trvání",
"Remaining Time": "Zbývající čas",
"Stream Type": "Stream Type",
"LIVE": "ŽIVĚ",
"Loaded": "Načteno",
"Progress": "Stav",
"Fullscreen": "Celá obrazovka",
"Non-Fullscreen": "Zmenšená obrazovka",
"Mute": "Ztlumit zvuk",
"Unmuted": "Přehrát zvuk",
"Playback Rate": "Rychlost přehrávání",
"Subtitles": "Titulky",
"subtitles off": "Titulky vypnuty",
"Captions": "Popisky",
"captions off": "Popisky vypnuty",
"Chapters": "Kapitoly",
"You aborted the video playback": "Přehrávání videa je přerušeno.",
"A network error caused the video download to fail part-way.": "Video nemohlo být načteno, kvůli chybě v síti.",
"The video could not be loaded, either because the server or network failed or because the format is not supported.": "Video nemohlo být načteno, buď kvůli chybě serveru nebo sítě nebo proto, že daný formát není podporován.",
"The video playback was aborted due to a corruption problem or because the video used features your browser did not support.": "Váš prohlížeč nepodporuje formát videa.",
"No compatible source was found for this video.": "Špatně zadaný zdroj videa."
});

26
dist/video-js/lang/vi.js vendored Normal file
View File

@ -0,0 +1,26 @@
videojs.addLanguage("vi",{
"Play": "Phát",
"Pause": "Tạm dừng",
"Current Time": "Thời gian hiện tại",
"Duration Time": "Độ dài",
"Remaining Time": "Thời gian còn lại",
"Stream Type": "Kiểu Stream",
"LIVE": "TRỰC TIẾP",
"Loaded": "Đã tải",
"Progress": "Tiến trình",
"Fullscreen": "Toàn màn hình",
"Non-Fullscreen": "Thoát toàn màn hình",
"Mute": "Tắt tiếng",
"Unmuted": "Bật âm thanh",
"Playback Rate": "Tốc độ phát",
"Subtitles": "Phụ đề",
"subtitles off": "Tắt phụ đề",
"Captions": "Chú thích",
"captions off": "Tắt chú thích",
"Chapters": "Chương",
"You aborted the video playback": "Bạn đã hủy việc phát video.",
"A network error caused the video download to fail part-way.": "Một lỗi mạng dẫn đến việc tải video bị lỗi.",
"The video could not be loaded, either because the server or network failed or because the format is not supported.": "Video không tải được, mạng hay server có lỗi hoặc định dạng không được hỗ trợ.",
"The video playback was aborted due to a corruption problem or because the video used features your browser did not support.": "Phát video đã bị hủy do một sai lỗi hoặc video sử dụng những tính năng trình duyệt không hỗ trợ.",
"No compatible source was found for this video.": "Không có nguồn tương thích cho video này."
});

27
dist/video-js/lang/zh-TW.js vendored Normal file
View File

@ -0,0 +1,27 @@
videojs.addLanguage("zh-TW",{
"Play": "播放",
"Pause": "暫停",
"Current Time": "目前時間",
"Duration Time": "總共時間",
"Remaining Time": "剩餘時間",
"Stream Type": "串流類型",
"LIVE": "直播",
"Loaded": "載入完畢",
"Progress": "進度",
"Fullscreen": "全螢幕",
"Non-Fullscreen": "退出全螢幕",
"Mute": "靜音",
"Unmuted": "取消靜音",
"Playback Rate": " 播放速率",
"Subtitles": "字幕",
"subtitles off": "關閉字幕",
"Captions": "內嵌字幕",
"captions off": "關閉內嵌字幕",
"Chapters": "章節",
"You aborted the video playback": "影片播放已終止",
"A network error caused the video download to fail part-way.": "網路錯誤導致影片下載失敗。",
"The video could not be loaded, either because the server or network failed or because the format is not supported.": "影片因格式不支援或者伺服器或網路的問題無法載入。",
"The video playback was aborted due to a corruption problem or because the video used features your browser did not support.": "由於影片檔案損毀或是該影片使用了您的瀏覽器不支援的功能,播放終止。",
"No compatible source was found for this video.": "無法找到相容此影片的來源。",
"The video is encrypted and we do not have the keys to decrypt it.": "影片已加密,無法解密。"
});

View File

@ -129,7 +129,7 @@ _inherited from_: [src/js/component.js#L536](https://github.com/videojs/video.js
##### RETURNS:
* `[type]` [description]
_defined in_: [src/js/media/html5.js#L368](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L368)
_defined in_: [src/js/media/html5.js#L380](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L380)
---
@ -141,7 +141,7 @@ _defined in_: [src/js/media/html5.js#L368](https://github.com/videojs/video.js/b
##### RETURNS:
* `Boolean`
_defined in_: [src/js/media/html5.js#L358](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L358)
_defined in_: [src/js/media/html5.js#L370](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L370)
---
@ -427,7 +427,7 @@ _inherited from_: [src/js/media/media.js#L55](https://github.com/videojs/video.j
##### RETURNS:
* `Boolean`
_defined in_: [src/js/media/html5.js#L282](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L282)
_defined in_: [src/js/media/html5.js#L290](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L290)
---
@ -769,7 +769,7 @@ _inherited from_: [src/js/component.js#L1020](https://github.com/videojs/video.j
* __source__ `Object` The source object
* __tech__ `vjs.Html5` The instance of the HTML5 tech
_defined in_: [src/js/media/html5.js#L302](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L302)
_defined in_: [src/js/media/html5.js#L310](https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L310)
---

View File

@ -1,7 +1,7 @@
{
"name": "video.js",
"description": "An HTML5 and Flash video player with a common API and skin for both.",
"version": "4.11.3",
"version": "4.11.4",
"copyright": "Copyright 2014 Brightcove, Inc. https://github.com/videojs/video.js/blob/master/LICENSE",
"keywords": [
"videojs",
@ -21,7 +21,7 @@
},
"main": "./dist/video-js/video.js",
"dependencies": {
"videojs-swf": "4.5.2"
"videojs-swf": "4.5.3"
},
"devDependencies": {
"calcdeps": "~0.1.7",

View File

@ -435,8 +435,8 @@ vjs.Component.prototype.removeChild = function(component){
if (!childFound) return;
this.childIndex_[component.id] = null;
this.childNameIndex_[component.name] = null;
this.childIndex_[component.id()] = null;
this.childNameIndex_[component.name()] = null;
var compEl = component.el();
if (compEl && compEl.parentNode === this.contentEl()) {

View File

@ -127,6 +127,7 @@ goog.exportSymbol('videojs.CaptionsButton', vjs.CaptionsButton);
goog.exportSymbol('videojs.ChaptersButton', vjs.ChaptersButton);
goog.exportSymbol('videojs.MediaTechController', vjs.MediaTechController);
goog.exportProperty(vjs.MediaTechController, 'withSourceHandlers', vjs.MediaTechController.withSourceHandlers);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresVolumeControl', vjs.MediaTechController.prototype.featuresVolumeControl);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresFullscreenResize', vjs.MediaTechController.prototype.featuresFullscreenResize);
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresPlaybackRate', vjs.MediaTechController.prototype.featuresPlaybackRate);
@ -134,7 +135,6 @@ goog.exportProperty(vjs.MediaTechController.prototype, 'featuresProgressEvents',
goog.exportProperty(vjs.MediaTechController.prototype, 'featuresTimeupdateEvents', vjs.MediaTechController.prototype.featuresTimeupdateEvents);
goog.exportProperty(vjs.MediaTechController.prototype, 'setPoster', vjs.MediaTechController.prototype.setPoster);
goog.exportSymbol('videojs.Html5', vjs.Html5);
goog.exportProperty(vjs.Html5, 'Events', vjs.Html5.Events);
goog.exportProperty(vjs.Html5, 'isSupported', vjs.Html5.isSupported);
@ -154,7 +154,11 @@ goog.exportProperty(vjs.Html5.prototype, 'enterFullScreen', vjs.Html5.prototype.
goog.exportProperty(vjs.Html5.prototype, 'exitFullScreen', vjs.Html5.prototype.exitFullScreen);
goog.exportProperty(vjs.Html5.prototype, 'playbackRate', vjs.Html5.prototype.playbackRate);
goog.exportProperty(vjs.Html5.prototype, 'setPlaybackRate', vjs.Html5.prototype.setPlaybackRate);
// Source Handler Functions
goog.exportProperty(vjs.Html5, 'registerSourceHandler', vjs.Html5.registerSourceHandler);
goog.exportProperty(vjs.Html5, 'selectSourceHandler', vjs.Html5.selectSourceHandler);
goog.exportProperty(vjs.Html5.prototype, 'setSource', vjs.Html5.prototype.setSource);
goog.exportProperty(vjs.Html5.prototype, 'disposeSourceHandler', vjs.Html5.prototype.disposeSourceHandler);
goog.exportSymbol('videojs.Flash', vjs.Flash);
goog.exportProperty(vjs.Flash, 'isSupported', vjs.Flash.isSupported);
@ -163,6 +167,11 @@ goog.exportProperty(vjs.Flash, 'onReady', vjs.Flash['onReady']);
goog.exportProperty(vjs.Flash, 'embed', vjs.Flash.embed);
goog.exportProperty(vjs.Flash, 'version', vjs.Flash.version);
goog.exportProperty(vjs.Flash.prototype, 'setSource', vjs.Flash.prototype.setSource);
// Source Handler Functions
goog.exportProperty(vjs.Flash, 'registerSourceHandler', vjs.Flash.registerSourceHandler);
goog.exportProperty(vjs.Flash, 'selectSourceHandler', vjs.Flash.selectSourceHandler);
goog.exportProperty(vjs.Flash.prototype, 'setSource', vjs.Flash.prototype.setSource);
goog.exportProperty(vjs.Flash.prototype, 'disposeSourceHandler', vjs.Flash.prototype.disposeSourceHandler);
goog.exportSymbol('videojs.TextTrack', vjs.TextTrack);
goog.exportProperty(vjs.TextTrack.prototype, 'label', vjs.TextTrack.prototype.label);

View File

@ -58,6 +58,7 @@ vjs.Html5.prototype.createEl = function(){
var player = this.player_,
// If possible, reuse original tag for HTML5 playback technology element
el = player.tag,
attributes,
newEl,
clone;
@ -74,8 +75,15 @@ vjs.Html5.prototype.createEl = function(){
player.tag = null;
} else {
el = vjs.createEl('video');
// determine if native controls should be used
attributes = videojs.util.mergeOptions({}, player.tagAttributes);
if (!vjs.TOUCH_ENABLED || player.options()['nativeControlsForTouch'] !== true) {
delete attributes.controls;
}
vjs.setElementAttributes(el,
vjs.obj.merge(player.tagAttributes || {}, {
vjs.obj.merge(attributes, {
id:player.id() + '_html5_api',
'class':'vjs-tech'
})
@ -307,13 +315,13 @@ vjs.Html5.nativeSourceHandler = {};
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
vjs.Html5.nativeSourceHandler.canHandleSource = function(source){
var ext;
var match, ext;
function canPlayType(type){
// IE9 on Windows 7 without MediaPlayer throws an error here
// https://github.com/videojs/video.js/issues/519
try {
return !!vjs.TEST_VID.canPlayType(type);
return vjs.TEST_VID.canPlayType(type);
} catch(e) {
return '';
}
@ -322,11 +330,15 @@ vjs.Html5.nativeSourceHandler.canHandleSource = function(source){
// If a type was provided we should rely on that
if (source.type) {
return canPlayType(source.type);
} else {
} else if (source.src) {
// If no type, fall back to checking 'video/[EXTENSION]'
ext = source.src.match(/\.([^\/\?]+)(\?[^\/]+)?$/i)[1];
match = source.src.match(/\.([^.\/\?]+)(\?[^\/]+)?$/i);
ext = match && match[1];
return canPlayType('video/'+ext);
}
return '';
};
/**

View File

@ -94,19 +94,34 @@ test('should be able to access expected component API methods', function() {
});
test('should be able to access expected MediaTech API methods', function() {
var techProto = videojs.MediaTechController.prototype;
var media = videojs.MediaTechController;
var mediaProto = videojs.MediaTechController.prototype;
var html5 = videojs.Html5;
var html5Proto = videojs.Html5.prototype;
var flash = videojs.Flash;
var flashProto = videojs.Flash.prototype;
ok(techProto.setPoster, 'setPoster should exist on the Media tech');
ok(mediaProto.setPoster, 'setPoster should exist on the Media tech');
ok(html5Proto.setPoster, 'setPoster should exist on the HTML5 tech');
ok(flashProto.setPoster, 'setPoster should exist on the Flash tech');
ok(videojs.Html5.patchCanPlayType, 'patchCanPlayType should exist for HTML5');
ok(videojs.Html5.unpatchCanPlayType, 'unpatchCanPlayType should exist for HTML5');
// Source Handler Functions
ok(media.withSourceHandlers, 'withSourceHandlers should exist for Media Tech');
ok(videojs.Html5.canPlaySource, 'canPlaySource should exist for HTML5');
ok(videojs.Html5.registerSourceHandler, 'registerSourceHandler should exist for Html5');
ok(videojs.Html5.selectSourceHandler, 'selectSourceHandler should exist for Html5');
ok(videojs.Html5.prototype.setSource, 'setSource should exist for Html5');
ok(videojs.Html5.prototype.disposeSourceHandler, 'disposeSourceHandler should exist for Html5');
ok(videojs.Flash.canPlaySource, 'canPlaySource should exist for Flash');
ok(videojs.Flash.registerSourceHandler, 'registerSourceHandler should exist for Flash');
ok(videojs.Flash.selectSourceHandler, 'selectSourceHandler should exist for Flash');
ok(videojs.Flash.prototype.setSource, 'setSource should exist for Flash');
ok(videojs.Flash.prototype.disposeSourceHandler, 'disposeSourceHandler should exist for Flash');
});
test('should export ready api call to public', function() {

View File

@ -10,7 +10,7 @@ module('HTML5', {
id: function(){ return 'id'; },
el: function(){ return el; },
options_: {},
options: function(){ return {}; },
options: function(){ return this.options_; },
bufferedPercent: function() { return 0; },
controls: function(){ return false; },
usingNativeControls: function(){ return false; },
@ -71,6 +71,19 @@ test('test playbackRate', function() {
strictEqual(tech.playbackRate(), 0.75);
});
test('should remove the controls attribute when recreating the element', function() {
var el;
player.tagAttributes = {
controls: true
};
// force custom controls so the test environment is equivalent on iOS
player.options_['nativeControlsForTouch'] = false;
el = tech.createEl();
ok(!el.controls, 'controls attribute is absent');
ok(player.tagAttributes.controls, 'tag attribute is still present');
});
test('patchCanPlayType patches canplaytype with our function, conditionally', function() {
// the patch runs automatically so we need to first unpatch
vjs.Html5.unpatchCanPlayType();
@ -134,3 +147,32 @@ test('error events may not set the errors property', function() {
test('should have the source handler interface', function() {
ok(vjs.Html5.registerSourceHandler, 'has the registerSourceHandler function');
});
test('native source handler canHandleSource', function(){
var result;
// Stub the test video canPlayType (used in canHandleSource) to control results
var origCPT = vjs.TEST_VID.canPlayType;
vjs.TEST_VID.canPlayType = function(type){
if (type === 'video/mp4') {
return 'maybe';
}
return '';
};
var canHandleSource = vjs.Html5.nativeSourceHandler.canHandleSource;
equal(canHandleSource({ type: 'video/mp4', src: 'video.flv' }), 'maybe', 'Native source handler reported type support');
equal(canHandleSource({ src: 'http://www.example.com/video.mp4' }), 'maybe', 'Native source handler reported extension support');
equal(canHandleSource({ src: 'https://example.com/video.sd.mp4?s=foo&token=bar' }), 'maybe', 'Native source handler reported extension support');
equal(canHandleSource({ src: 'https://example.com/video.sd.mp4?s=foo' }), 'maybe', 'Native source handler reported extension support');
// Test for issue videojs/video.js#1785 and other potential failures
equal(canHandleSource({ src: '' }), '', 'Native source handler handled empty src');
equal(canHandleSource({}), '', 'Native source handler handled empty object');
equal(canHandleSource({ src: 'foo' }), '', 'Native source handler handled bad src');
equal(canHandleSource({ type: 'foo' }), '', 'Native source handler handled bad type');
// Reset test video canPlayType
vjs.TEST_VID.canPlayType = origCPT;
});

View File

@ -534,7 +534,7 @@ test('should restore attributes from the original video tag when creating a new
// simulate attributes stored from the original tag
player.tagAttributes = {
'preload': 'auto',
'controls': true,
'autoplay': true,
'webkit-playsinline': true
};
@ -545,7 +545,7 @@ test('should restore attributes from the original video tag when creating a new
el = vjs.Html5.prototype.createEl.call(html5Mock);
equal(el.getAttribute('preload'), 'none', 'attribute was successful overridden by an option');
equal(el.getAttribute('controls'), '', 'controls attribute was set properly');
equal(el.getAttribute('autoplay'), '', 'autoplay attribute was set properly');
equal(el.getAttribute('webkit-playsinline'), '', 'webkit-playsinline attribute was set properly');
});