Skip to content

Commit

Permalink
Streaming server can play (#48)
Browse files Browse the repository at this point in the history
* check if at least 1 audio/video stream is supported

* 0.0.25-rc.3

* update node

* add webm format

* 0.0.25-rc.4

* update media capabilities detection

* force stereo audio on chrome

* force stereo audio on chromecast

* revert formatting

* fix lint

* override media capabilities with command args

* fix lint

* fix lint

* fix lint

* 0.0.25-rc.5

* remove merge with

* revert format specific codec checks

* reformat

* revert changes in ss middleware

* add support for mkv only in chrome

* 0.0.25-rc.6
  • Loading branch information
unclekingpin authored Nov 5, 2023
1 parent ba3e62a commit d1af226
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
14 changes: 9 additions & 5 deletions src/mediaCapabilities.js
Original file line number Diff line number Diff line change
@@ -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']
},
Expand Down Expand Up @@ -46,18 +48,17 @@ 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() {
if (/firefox/i.test(window.navigator.userAgent)) {
return 6;
}

if (!window.AudioContext) {
if (!window.AudioContext || window.chrome || window.cast) {
return 2;
}

Expand All @@ -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 });
Expand Down

0 comments on commit d1af226

Please sign in to comment.