Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device detection and profile for Hub Max and CC Google TV #71

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/components/castDevices.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ const castContext = cast.framework.CastReceiverContext.getInstance();

// Device Ids
export const deviceIds = {
GEN1n2: 1,
GEN1AND2: 1,
AUDIO: 2,
GEN3: 3,
ULTRA: 4,
NESTHUB: 5
NESTHUBANDMAX: 5, //Nest hub and Nest hub max
CCGTV: 6 //Chromecast Google TV
}


Expand All @@ -22,12 +23,12 @@ export function getActiveDeviceId() {
castContext.canDisplayType("video/webm", "vp9")) {
return deviceIds.ULTRA;
} else if (castContext.canDisplayType("video/webm", "vp9")) {
return deviceIds.NESTHUB;
return deviceIds.NESTHUBANDMAX;
} else if (castContext.canDisplayType("video/mp4", "avc1.64002A")) {
return deviceIds.GEN3;
} else if (castContext.canDisplayType("video/mp4", "avc1.640029")) {
return deviceIds.GEN1n2;
return deviceIds.GEN1AND2;
} else {
return deviceIds.AUDIO;
}
}
}
16 changes: 9 additions & 7 deletions src/components/codecsupporthelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ export function getMaxBitrateSupport() {
export function getMaxWidthSupport(deviceId) {
switch (deviceId) {
case deviceIds.ULTRA:
case deviceIds.CCGTV:
return 3840;
case deviceIds.GEN1n2:
case deviceIds.GEN1AND2:
case deviceIds.GEN3:
return 1920;
case deviceIds.NESTHUB:
case deviceIds.NESTHUBANDMAX:
return 1280;
}
}
Expand All @@ -56,8 +57,8 @@ export function getH26xProfileSupport(deviceId) {
// These are supported by all Cast devices, excluding audio only devices.
let h26xProfiles = "high|main|baseline|constrained baseline";

if (deviceId === deviceIds.ULTRA) {
h264Profiles += "|high 10"
if (deviceId === deviceIds.ULTRA || deviceId === deviceIds.CCGTV) {
h26xProfiles += "|high 10"
}

return h26xProfiles;
Expand All @@ -70,12 +71,13 @@ export function getH26xProfileSupport(deviceId) {
*/
export function getH26xLevelSupport(deviceId) {
switch (deviceId) {
case deviceIds.NESTHUB:
case deviceIds.GEN1n2:
case deviceIds.NESTHUBANDMAX:
case deviceIds.GEN1AND2:
return 41;
case deviceIds.GEN3:
return 42;
case deviceIds.ULTRA:
case deviceIds.CCGTV:
return 52;
}
}
Expand Down Expand Up @@ -153,4 +155,4 @@ export function getSupportedWebMAudioCodecs() {
*/
export function getSupportedAudioCodecs() {
return ["opus", "mp3", "aac", "flac", "webma", "wav"];
}
}
1 change: 1 addition & 0 deletions src/components/deviceprofilebuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
deviceIds,
getActiveDeviceId
} from "./castDevices";

import {
hasTextTrackSupport,
hasVP8Support,
Expand Down