2021-10-22 18:27:02 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset=utf-8>
|
|
|
|
<title>HLS WebM test</title>
|
|
|
|
<link rel=stylesheet type=text/css href=video-js/video-js.css>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>HLS WebM test</h1>
|
|
|
|
|
|
|
|
<p id=hls>Checking HLS support...</p>
|
2021-10-22 22:37:37 +00:00
|
|
|
<p id=mse>Checking MSE VP9 support...</p>
|
2021-10-22 18:27:02 +00:00
|
|
|
<p id=webm>Checking flat WebM VP8 / Vorbis support...</p>
|
|
|
|
<p id=wasm>Checking WebAssembly support...</p>
|
|
|
|
|
|
|
|
<h2>Caminandes - Llamigos</h2>
|
|
|
|
|
2021-10-23 00:44:04 +00:00
|
|
|
<p>HLS with VP9-in-MP4 video and Opus-in-MP4 and MP3 audio. Flat WebM fallback with ogv.js loader.</p>
|
2021-10-22 22:37:37 +00:00
|
|
|
<video id=hls1 controls width=640 height=360>
|
|
|
|
<source type=application/vnd.apple.mpegurl src=llamigos-vp9-mp3-opus.m3u8>
|
2021-10-22 18:27:02 +00:00
|
|
|
<source type=video/webm src=caminandes-llamigos.webm.flat.webm>
|
|
|
|
</video>
|
|
|
|
|
2021-10-23 00:44:04 +00:00
|
|
|
<p>Desired behavior:</p>
|
2021-10-22 22:37:37 +00:00
|
|
|
<ul>
|
2021-10-23 00:44:04 +00:00
|
|
|
<li>Firefox/Chrome: play via MSE with VP9/Opus (currently issues with using Opus in VHS)</li>
|
|
|
|
<li>Desktop Safari with VP9 support: play via MSE with VP9/MP3 (MP3 buffers not adding spaces as expected)</li>
|
|
|
|
<li>iOS Safari with VP9 support: play native HLS with VP9/MP3 (works)</li>
|
|
|
|
<li>Older iOS and desktop Safari without VP9: play via ogv.js with WebM VP8/Vorbis (?)</li>
|
2021-10-22 22:37:37 +00:00
|
|
|
<li>Very old Firefox/Chrome: play native WebM VP8/Vorbis</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
<p>HLS with VP9 video and Opus, AAC, and MP3 audio. Flag WebM fallback.</p>
|
2021-10-22 18:27:02 +00:00
|
|
|
<video id=hls1 controls width=640 height=360>
|
2021-10-22 22:37:37 +00:00
|
|
|
<source type=application/vnd.apple.mpegurl src=llamigos-vp9-opus-aac-mp3.m3u8>
|
2021-10-22 18:27:02 +00:00
|
|
|
<source type=video/webm src=caminandes-llamigos.webm.flat.webm>
|
|
|
|
</video>
|
|
|
|
|
2021-10-22 22:37:37 +00:00
|
|
|
<p>Expected behavior:</p>
|
|
|
|
<ul>
|
|
|
|
<li>Firefox/Chrome: MSE VP9/Opus (AAC for now)</li>
|
|
|
|
<li>Desktop Safari with VP9 support: MSE VP9/MP3 (AAC for now?)</li>
|
|
|
|
<li>iOS Safari with VP9 support: HLS VP9/MP3 (AAC for now?)</li>
|
|
|
|
<li>Older iOS and desktop Safari without VP9: ogv.js VP8/Vorbis</li>
|
|
|
|
<li>Very old Firefox/Chrome: native WebM VP8/Vorbis</li>
|
|
|
|
</ul>
|
|
|
|
-->
|
2021-10-22 18:27:02 +00:00
|
|
|
|
2021-10-23 00:49:46 +00:00
|
|
|
<!--
|
2021-10-23 00:44:04 +00:00
|
|
|
<p>HLS with VP9 video and AAC audio. Flag WebM fallback.</p>
|
2021-10-22 22:37:37 +00:00
|
|
|
<video id=hls1 controls width=640 height=360>
|
|
|
|
<source type=application/vnd.apple.mpegurl src=llamigos-vp9-aac.m3u8>
|
2021-10-22 18:27:02 +00:00
|
|
|
<source type=video/webm src=caminandes-llamigos.webm.flat.webm>
|
|
|
|
</video>
|
|
|
|
|
2021-10-22 22:37:37 +00:00
|
|
|
<p>Expected behavior:</p>
|
|
|
|
<ul>
|
|
|
|
<li>Firefox/Chrome: MSE VP9/Opus (AAC for now)</li>
|
|
|
|
<li>Desktop Safari with VP9 support: MSE VP9/MP3 (AAC for now?)</li>
|
|
|
|
<li>iOS Safari with VP9 support: HLS VP9/MP3 (AAC for now?)</li>
|
|
|
|
<li>Older iOS and desktop Safari without VP9: ogv.js VP8/Vorbis</li>
|
|
|
|
<li>Very old Firefox/Chrome: native WebM VP8/Vorbis</li>
|
|
|
|
</ul>
|
2021-10-23 00:49:46 +00:00
|
|
|
-->
|
2021-10-22 18:27:02 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
if (hls1.canPlayType('application/vnd.apple.mpegurl')) {
|
|
|
|
hls.textContent = 'native HLS playback supported';
|
|
|
|
hls.style.color = 'green';
|
|
|
|
} else {
|
|
|
|
hls.textContent = 'no native HLS';
|
|
|
|
hls.style.color = 'red';
|
|
|
|
}
|
|
|
|
if (typeof MediaSource == 'function') {
|
2021-10-22 22:37:37 +00:00
|
|
|
let codecs = [
|
|
|
|
['VP9-in-MP4', 'video/mp4; codecs="vp09.00.10.08"'],
|
2021-10-27 19:58:33 +00:00
|
|
|
['Opus-in-WebM', 'audio/webm; codecs="opus"'],
|
2021-10-22 22:37:37 +00:00
|
|
|
['MP3', 'audio/mp3'],
|
|
|
|
];
|
|
|
|
let yes = [];
|
|
|
|
let no = [];
|
|
|
|
for (let [name, mime] of codecs) {
|
|
|
|
if (MediaSource.isTypeSupported(mime)) {
|
|
|
|
yes.push(name);
|
|
|
|
} else {
|
|
|
|
no.push(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (yes.length == codecs.length) {
|
|
|
|
mse.textContent = 'MSE supports ' + yes.join(', ');
|
2021-10-22 18:27:02 +00:00
|
|
|
mse.style.color = 'green';
|
|
|
|
} else {
|
2021-10-22 22:37:37 +00:00
|
|
|
mse.textContent = 'MSE supports ' + yes.join(', ') + ' but not ' + no.join(', ');
|
2021-10-22 18:27:02 +00:00
|
|
|
mse.style.color = 'orange';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mse.textContent = 'MSE not supported';
|
|
|
|
mse.style.color = 'red';
|
|
|
|
}
|
2021-10-22 22:37:37 +00:00
|
|
|
if (hls1.canPlayType('video/webm; codecs="vp8, vorbis"')) {
|
|
|
|
webm.textContent = 'flat WebM VP8/Vorbis supported';
|
2021-10-22 18:27:02 +00:00
|
|
|
webm.style.color = 'green';
|
|
|
|
} else {
|
2021-10-22 22:37:37 +00:00
|
|
|
webm.textContent = 'flat WebM VP8/Vorbis not supported';
|
2021-10-22 18:27:02 +00:00
|
|
|
webm.style.color = 'red';
|
|
|
|
}
|
|
|
|
if (typeof WebAssembly == 'object') {
|
|
|
|
wasm.textContent = 'WebAssembly supported';
|
|
|
|
wasm.style.color = 'green';
|
|
|
|
} else {
|
|
|
|
wasm.textContent = 'no WebAssembly support';
|
|
|
|
wasm.style.color = 'red';
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script src=ogvjs-1.8.4/ogv.js></script>
|
2021-10-27 19:40:02 +00:00
|
|
|
<script src=video-js/alt/video.core.js></script>
|
2021-10-27 19:58:33 +00:00
|
|
|
<script src=videojs-http-streaming.js></script>
|
2021-10-22 18:27:02 +00:00
|
|
|
<script src=videojs-ogvjs.js></script>
|
2021-10-22 22:37:37 +00:00
|
|
|
<script>
|
2021-10-22 18:27:02 +00:00
|
|
|
var playerConfig = {
|
|
|
|
responsive: true,
|
|
|
|
controlBar: {
|
|
|
|
volumePanel: {
|
|
|
|
vertical: true,
|
|
|
|
inline: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
techOrder: [ 'html5' ],
|
|
|
|
html5: {}
|
|
|
|
};
|
|
|
|
|
2021-10-22 22:37:37 +00:00
|
|
|
function can(mime) {
|
|
|
|
return (typeof MediaSource == 'function') && MediaSource.isTypeSupported(mime);
|
|
|
|
}
|
|
|
|
var vp9 = can('video/mp4; codecs="vp09.00.10.08"');
|
2021-10-27 19:58:33 +00:00
|
|
|
var opus = can('audio/webm; codecs="opus"');
|
2021-10-23 00:49:46 +00:00
|
|
|
var aac = can('audio/mp4; codecs="mp4a.40.02');
|
|
|
|
var mp3 = can('audio/mp3');
|
|
|
|
//var mp3 = can('audio/mp4; codecs="mp4a.40.34"');
|
2021-10-27 19:40:02 +00:00
|
|
|
var mse = vp9 && (opus || mp3);
|
2021-10-22 18:27:02 +00:00
|
|
|
if (mse) {
|
|
|
|
// enable streaming plugin
|
|
|
|
playerConfig.html5.vhs = {
|
|
|
|
overrideNative: true,
|
|
|
|
useDevicePixelRatio: true
|
|
|
|
};
|
2021-10-22 22:37:37 +00:00
|
|
|
console.log('will do mse');
|
|
|
|
} else {
|
|
|
|
console.log('wont do mse');
|
2021-10-22 18:27:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var webm = null;
|
|
|
|
for (let source of hls1.querySelectorAll('source')) {
|
|
|
|
if (source.type.startsWith('video/webm')) {
|
|
|
|
webm = source;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var ogv = webm &&
|
|
|
|
!mse &&
|
|
|
|
!hls1.canPlayType(webm.type) &&
|
|
|
|
(typeof WebAssembly == 'object') &&
|
|
|
|
(typeof WebAssembly.Module == 'function');
|
|
|
|
if (ogv) {
|
|
|
|
console.log('can do ogvjs');
|
2021-10-23 00:44:04 +00:00
|
|
|
var base = '/misc/hls-test/ogvjs-1.8.4';//new URL('./ogvjs-1.8.4', document.location.pathname)
|
2021-10-22 18:27:02 +00:00
|
|
|
playerConfig.ogvjs = {
|
2021-10-23 00:44:04 +00:00
|
|
|
base: base
|
2021-10-22 18:27:02 +00:00
|
|
|
};
|
|
|
|
console.log(playerConfig.ogvjs.base);
|
|
|
|
playerConfig.techOrder.push('ogvjs');
|
|
|
|
} else {
|
|
|
|
console.log('wont do ogvjs');
|
|
|
|
}
|
2021-10-22 22:37:37 +00:00
|
|
|
|
|
|
|
videojs.log.level('debug');
|
2021-10-22 18:27:02 +00:00
|
|
|
|
|
|
|
hls1.classList.add('video-js');
|
|
|
|
hls1.classList.add('vjs-default-skin');
|
|
|
|
var vjs1 = videojs(hls1, playerConfig);
|
|
|
|
|
|
|
|
vjs1.on('error', function failover() {
|
|
|
|
console.log('got error');
|
|
|
|
var error = vjs1.error();
|
|
|
|
if (error && error.code == MediaError.MEDIA_ERR_DECODE) {
|
|
|
|
console.log('saw its decode');
|
|
|
|
// HLS reports this if it can't find a codec it likes
|
|
|
|
if (webm) {
|
|
|
|
console.log('going to ' + webm.getAttribute('src'));
|
|
|
|
vjs1.src([{
|
|
|
|
src: webm.getAttribute('src'),
|
|
|
|
type: webm.getAttribute('type')
|
|
|
|
}]);
|
|
|
|
vjs1.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vjs1.off('error', failover);
|
|
|
|
});
|
|
|
|
|
2021-10-22 22:37:37 +00:00
|
|
|
// this fails on Chrome with a blob issue on the HLS player :D
|
|
|
|
//vjs1.load();
|
2021-10-22 18:27:02 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|