-
-
Save bittu/282df7c97f078e707998b80cfee03fe8 to your computer and use it in GitHub Desktop.
Revisions
-
bittu revised this gist
Aug 24, 2022 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,20 +17,20 @@ const getModelInfo = () => { const context = cast.framework.CastReceiverContext.getInstance(); // Google TV with Chromecast supports 'H.264 High Profile, level 5.1' if (context.canDisplayType('video/mp4; codecs="avc1.640033')) { return 'cc-googletv'; } // Android TV with Chromecast built-in if (userAgent.includes('Android')) { return 'cc-builtin'; } // Chromecast Ultra supports 'HEVC main profile, level 3.1' if (MediaSource.isTypeSupported('video/mp4; codecs=hev1.1.6.L93.B0')) { return 'cc-ultra'; } // 3rd generation Chromecast supports 'H.264 high profile, level 4.2' if (MediaSource.isTypeSupported('video/mp4; codecs=avc1.64002A')) { return 'cc-3'; } // 2nd and 1st generation Chromecast can be differentiated by hardwareConcurrency if (hardwareConcurrency === 2) { return 'cc-2'; } if (hardwareConcurrency === 1) { return 'cc-1'; } } catch (e) { // do nothing } -
bittu revised this gist
Aug 24, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ * cc-3: Chromecast 3rd Gen. * cc-ultra: Chromecast Ultra * cc-builtin: Android TV with Chromecast built-in * cc-googletv: Google TV with Chromecast * */ const getModelInfo = () => { // https://developers.google.com/cast/docs/media#video_codecs -
bittu revised this gist
Aug 24, 2022 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,10 @@ const getModelInfo = () => { // https://developers.google.com/cast/docs/media#video_codecs try { const { hardwareConcurrency, userAgent } = window.navigator; const context = cast.framework.CastReceiverContext.getInstance(); // Google TV with Chromecast supports 'H.264 High Profile, level 5.1' if (context.canDisplayType('video/mp4; codecs="avc1.640033')) return 'cc-googletv'; // Android TV with Chromecast built-in if (userAgent.includes('Android')) return 'cc-builtin'; -
lfalke revised this gist
Mar 25, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ * cc-2: Chromecast 2nd Gen. * cc-3: Chromecast 3rd Gen. * cc-ultra: Chromecast Ultra * cc-builtin: Android TV with Chromecast built-in */ const getModelInfo = () => { // https://developers.google.com/cast/docs/media#video_codecs -
lfalke revised this gist
Mar 25, 2020 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,10 @@ const getModelInfo = () => { // https://developers.google.com/cast/docs/media#video_codecs try { const { hardwareConcurrency, userAgent } = window.navigator; // Android TV with Chromecast built-in if (userAgent.includes('Android')) return 'cc-builtin'; // Chromecast Ultra supports 'HEVC main profile, level 3.1' if (MediaSource.isTypeSupported('video/mp4; codecs=hev1.1.6.L93.B0')) return 'cc-ultra'; -
lfalke revised this gist
Mar 24, 2020 . 1 changed file with 12 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,14 +8,19 @@ * cc-ultra: Chromecast Ultra */ const getModelInfo = () => { // https://developers.google.com/cast/docs/media#video_codecs try { const { hardwareConcurrency } = window.navigator; // Chromecast Ultra supports 'HEVC main profile, level 3.1' if (MediaSource.isTypeSupported('video/mp4; codecs=hev1.1.6.L93.B0')) return 'cc-ultra'; // 3rd generation Chromecast supports 'H.264 high profile, level 4.2' if (MediaSource.isTypeSupported('video/mp4; codecs=avc1.64002A')) return 'cc-3'; // 2nd and 1st generation Chromecast can be differentiated by hardwareConcurrency if (hardwareConcurrency === 2) return 'cc-2'; if (hardwareConcurrency === 1) return 'cc-1'; } catch (e) { // do nothing } -
lfalke revised this gist
Mar 17, 2020 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,12 @@ /** * We use this workaround to detect the Chromecast device generation. * Unfortunately the Cast Application Framework (CAF) does not have an API for that. * * cc-1: Chromecast 1st Gen. * cc-2: Chromecast 2nd Gen. * cc-3: Chromecast 3rd Gen. * cc-ultra: Chromecast Ultra */ const getModelInfo = () => { try { if (MediaSource.isTypeSupported('video/mp4; codecs=hev1.1.6.L90.B0')) return 'cc-ultra'; @@ -8,7 +17,7 @@ const getModelInfo = () => { return MediaSource.isTypeSupported('video/mp4; codecs=avc1.64002A') ? 'cc-3' : 'cc-2'; } } catch (e) { // do nothing } return 'cc-unknown'; -
lfalke renamed this gist
Mar 17, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
lfalke created this gist
Mar 17, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ const getModelInfo = () => { try { if (MediaSource.isTypeSupported('video/mp4; codecs=hev1.1.6.L90.B0')) return 'cc-ultra'; if (window.navigator.hardwareConcurrency === 1) return 'cc-1'; if (window.navigator.hardwareConcurrency === 2) { // if H.264 level 4.2 is supported, it's a 3rd generation chromecast // https://developers.google.com/cast/docs/media#video_codecs return MediaSource.isTypeSupported('video/mp4; codecs=avc1.64002A') ? 'cc-3' : 'cc-2'; } } catch (e) { // error handling } return 'cc-unknown'; };