diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 28f07e4..42be410 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,7 +11,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v1 with: - node-version: 10 + node-version: 16 registry-url: https://registry.npmjs.org/ - name: Checkout uses: actions/checkout@v2 diff --git a/package.json b/package.json index 6183423..f26b37d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stremio/stremio-video", - "version": "0.0.25-rc.2", + "version": "0.0.25-rc.6", "description": "Abstraction layer on top of different media players", "author": "Smart Code OOD", "main": "src/index.js", diff --git a/src/mediaCapabilities.js b/src/mediaCapabilities.js index 4641e6f..79c349b 100644 --- a/src/mediaCapabilities.js +++ b/src/mediaCapabilities.js @@ -1,10 +1,12 @@ var VIDEO_CODEC_CONFIGS = [ { codec: 'h264', + force: window.chrome || window.cast, mime: 'video/mp4; codecs="avc1.42E01E"', }, { codec: 'h265', + force: window.chrome || window.cast, mime: 'video/mp4; codecs="hev1.1.6.L150.B0"', aliases: ['hevc'] }, @@ -46,10 +48,9 @@ var AUDIO_CODEC_CONFIGS = [ ]; function canPlay(config, options) { - return options.mediaElement.canPlayType(config.mime) ? - [config.codec].concat(config.aliases || []) - : - []; + return config.force || options.mediaElement.canPlayType(config.mime) + ? [config.codec].concat(config.aliases || []) + : []; } function getMaxAudioChannels() { @@ -57,7 +58,7 @@ function getMaxAudioChannels() { return 6; } - if (!window.AudioContext) { + if (!window.AudioContext || window.chrome || window.cast) { return 2; } @@ -68,6 +69,9 @@ function getMaxAudioChannels() { function getMediaCapabilities() { var mediaElement = document.createElement('video'); var formats = ['mp4']; + if (window.chrome || window.cast) { + formats.push('matroska,webm'); + } var videoCodecs = VIDEO_CODEC_CONFIGS .map(function(config) { return canPlay(config, { mediaElement: mediaElement });