Skip to content

Commit 27a6e2d

Browse files
committed
fix(Cast): Incorrect detection of MediaCapabilities on Linux Chromecast
1 parent d407d15 commit 27a6e2d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/polyfill/media_capabilities.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,18 @@ shaka.polyfill.MediaCapabilities = class {
327327

328328
let displayType = videoConfig.contentType;
329329
if (videoConfig.width && videoConfig.height) {
330-
displayType +=
331-
`; width=${videoConfig.width}; height=${videoConfig.height}`;
330+
// All Chromecast can support 720p videos
331+
if (videoConfig.width > 1280 || videoConfig.height > 720) {
332+
displayType +=
333+
`; width=${videoConfig.width}; height=${videoConfig.height}`;
334+
}
332335
}
333336
if (videoConfig.framerate) {
334-
displayType += `; framerate=${videoConfig.framerate}`;
337+
// All Chromecast can support a framerate of 24, 25 or 30.
338+
const framerate = Math.round(videoConfig.framerate);
339+
if (framerate < 24 || framerate > 30) {
340+
displayType += `; framerate=${videoConfig.framerate}`;
341+
}
335342
}
336343
if (videoConfig.transferFunction === 'pq') {
337344
// A "PQ" transfer function indicates this is an HDR-capable stream;

0 commit comments

Comments
 (0)