diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index a550b69198..32bac0bf11 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -176,6 +176,16 @@ define(['browser'], function (browser) { return false; } + function testCanPlayAv1(videoTestElement) { + if (browser.tizenVersion >= 5.5) { + return true; + } else if (browser.web0sVersion >= 5 && window.outerHeight >= 2160) { + return true; + } + + return videoTestElement.canPlayType('video/webm; codecs="av01.0.15M.10"').replace(/no/, ''); + } + function testCanPlayTs() { return browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp; } @@ -317,7 +327,6 @@ define(['browser'], function (browser) { var canPlayVp8 = videoTestElement.canPlayType('video/webm; codecs="vp8"').replace(/no/, ''); var canPlayVp9 = videoTestElement.canPlayType('video/webm; codecs="vp9"').replace(/no/, ''); - var canPlayAv1 = videoTestElement.canPlayType('video/webm; codecs="av1"').replace(/no/, ''); var webmAudioCodecs = ['vorbis']; var canPlayMkv = testCanPlayMkv(videoTestElement); @@ -459,6 +468,7 @@ define(['browser'], function (browser) { }); var mp4VideoCodecs = []; + var webmVideoCodecs = []; var hlsVideoCodecs = []; if (canPlayH264(videoTestElement)) { @@ -490,16 +500,32 @@ define(['browser'], function (browser) { if (canPlayVp8) { mp4VideoCodecs.push('vp8'); + webmVideoCodecs.push('vp8'); } if (canPlayVp9) { mp4VideoCodecs.push('vp9'); + webmVideoCodecs.push('vp9'); + } + + if (testCanPlayAv1(videoTestElement)) { + mp4VideoCodecs.push('av1'); + webmVideoCodecs.push('av1'); } if (canPlayVp8 || browser.tizen || browser.orsay) { videoAudioCodecs.push('vorbis'); } + if (webmVideoCodecs.length) { + profile.DirectPlayProfiles.push({ + Container: 'webm', + Type: 'Video', + VideoCodec: webmVideoCodecs.join(','), + AudioCodec: webmAudioCodecs.join(',') + }); + } + if (mp4VideoCodecs.length) { profile.DirectPlayProfiles.push({ Container: 'mp4,m4v', @@ -558,33 +584,6 @@ define(['browser'], function (browser) { } }); - if (canPlayVp8) { - profile.DirectPlayProfiles.push({ - Container: 'webm', - Type: 'Video', - AudioCodec: webmAudioCodecs.join(','), - VideoCodec: 'VP8' - }); - } - - if (canPlayVp9) { - profile.DirectPlayProfiles.push({ - Container: 'webm', - Type: 'Video', - AudioCodec: webmAudioCodecs.join(','), - VideoCodec: 'VP9' - }); - } - - if (canPlayAv1) { - profile.DirectPlayProfiles.push({ - Container: 'webm', - Type: 'Video', - AudioCodec: webmAudioCodecs.join(','), - VideoCodec: 'AV1' - }); - } - profile.TranscodingProfiles = []; var hlsBreakOnNonKeyFrames = browser.iOS || browser.osx || browser.edge || !canPlayNativeHls() ? true : false;