mirror of
https://github.com/videojs/video.js.git
synced 2024-12-27 02:43:45 +02:00
Allow setting a custom incompatible video message. fixes #636
This commit is contained in:
parent
fdf7f4f228
commit
918ee040e1
@ -739,8 +739,18 @@ vjs.Player.prototype.src = function(source){
|
||||
this.loadTech(techName, source);
|
||||
}
|
||||
} else {
|
||||
var incompatibleMessage;
|
||||
if (videojs.options['incompatibleVideoMessage']) {
|
||||
incompatibleMessage = vjs.options['incompatibleVideoMessage'];
|
||||
} else {
|
||||
incompatibleMessage = 'Sorry, no compatible source and playback ' +
|
||||
'technology were found for this video. Try using another browser ' +
|
||||
'like <a href="http://bit.ly/ccMUEC">Chrome</a> or download the ' +
|
||||
'latest <a href="http://adobe.ly/mwfN1">Adobe Flash Player</a>.';
|
||||
}
|
||||
|
||||
this.el_.appendChild(vjs.createEl('p', {
|
||||
innerHTML: 'Sorry, no compatible source and playback technology were found for this video. Try using another browser like <a href="http://bit.ly/ccMUEC">Chrome</a> or download the latest <a href="http://adobe.ly/mwfN1">Adobe Flash Player</a>.'
|
||||
innerHTML: incompatibleMessage
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -247,3 +247,23 @@ test('should set controls and trigger event', function() {
|
||||
// player.requestFullScreen();
|
||||
// });
|
||||
|
||||
test('should use custom message when encountering an unsupported video type',
|
||||
function() {
|
||||
videojs.options['incompatibleVideoMessage'] = 'Video no go';
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
|
||||
var html =
|
||||
'<video id="example_1">' +
|
||||
'<source src="fake.foo" type="video/foo">' +
|
||||
'</video>';
|
||||
|
||||
fixture.innerHTML += html;
|
||||
|
||||
var tag = document.getElementById('example_1');
|
||||
var player = new vjs.Player(tag);
|
||||
|
||||
var incompatibilityMessage = player.el().getElementsByTagName('p')[0];
|
||||
equal(incompatibilityMessage.textContent, 'Video no go');
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user