diff --git a/src/js/player.js b/src/js/player.js index 07f853c72..3d64220c0 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -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 Chrome or download the ' + + 'latest Adobe Flash Player.'; + } + this.el_.appendChild(vjs.createEl('p', { - innerHTML: 'Sorry, no compatible source and playback technology were found for this video. Try using another browser like Chrome or download the latest Adobe Flash Player.' + innerHTML: incompatibleMessage })); } diff --git a/test/unit/player.js b/test/unit/player.js index 18fb8d0e2..3be6be399 100644 --- a/test/unit/player.js +++ b/test/unit/player.js @@ -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 = + ''; + + 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(); +});