mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 06:03:27 +00:00
chromecast: add alert if scrypted cloud is not installed or set up.
This commit is contained in:
@@ -1,15 +1,5 @@
|
||||
# Send video, audio, and text to speech notifications to Chromecast and Google Home devices
|
||||
# Chromecast Plugin for Scrypted.
|
||||
|
||||
## npm commands
|
||||
* npm run scrypted-webpack
|
||||
* npm run scrypted-deploy <ipaddress>
|
||||
* npm run scrypted-debug <ipaddress>
|
||||
Send media to Chromecast and Google Home devices.
|
||||
|
||||
## scrypted distribution via npm
|
||||
1. Ensure package.json is set up properly for publishing on npm.
|
||||
2. npm publish
|
||||
|
||||
## Visual Studio Code configuration
|
||||
|
||||
* If using a remote server, edit [.vscode/settings.json](blob/master/.vscode/settings.json) to specify the IP Address of the Scrypted server.
|
||||
* Launch Scrypted Debugger from the launch menu.
|
||||
Scrypted Cloud setup is required for live streams.
|
||||
|
||||
4
plugins/chromecast/package-lock.json
generated
4
plugins/chromecast/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/chromecast",
|
||||
"version": "0.1.53",
|
||||
"version": "0.1.55",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/chromecast",
|
||||
"version": "0.1.53",
|
||||
"version": "0.1.55",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/chromecast",
|
||||
"version": "0.1.53",
|
||||
"version": "0.1.55",
|
||||
"description": "Send video, audio, and text to speech notifications to Chromecast and Google Home devices",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
@@ -30,7 +30,8 @@
|
||||
"DeviceProvider"
|
||||
],
|
||||
"pluginDependencies": [
|
||||
"@scrypted/webrtc"
|
||||
"@scrypted/webrtc",
|
||||
"@scrypted/cloud"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -201,7 +201,15 @@ class CastDevice extends ScryptedDeviceBase implements MediaPlayer, Refresh, Eng
|
||||
|
||||
const engineio = await endpointManager.getPublicLocalEndpoint(this.nativeId) + 'engine.io/';
|
||||
const mo = await mediaManager.createMediaObject(Buffer.from(engineio), ScryptedMimeTypes.LocalUrl);
|
||||
const cameraStreamAuthToken = await mediaManager.convertMediaObjectToUrl(mo, ScryptedMimeTypes.LocalUrl);
|
||||
let cameraStreamAuthToken: string;
|
||||
|
||||
try {
|
||||
cameraStreamAuthToken= await mediaManager.convertMediaObjectToUrl(mo, ScryptedMimeTypes.LocalUrl);
|
||||
}
|
||||
catch (e) {
|
||||
this.log.a('Streaming failed. Install and set up Scrypted Cloud to cast this media type.');
|
||||
throw e;
|
||||
}
|
||||
|
||||
const castMedia: any = {
|
||||
contentId: cameraStreamAuthToken,
|
||||
@@ -550,7 +558,7 @@ class CastDeviceProvider extends ScryptedDeviceBase implements DeviceProvider {
|
||||
return ret;
|
||||
}
|
||||
|
||||
async releaseDevice(id: string, nativeId: string, device: any): Promise<void> {
|
||||
async releaseDevice(id: string, nativeId: string): Promise<void> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
4
plugins/webrtc/package-lock.json
generated
4
plugins/webrtc/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
"@scrypted/sdk": "file:../../sdk",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"scripts": {
|
||||
"scrypted-setup-project": "scrypted-setup-project",
|
||||
"prescrypted-setup-project": "scrypted-package-json",
|
||||
|
||||
@@ -47,7 +47,7 @@ export async function createTrackForwarder(options: {
|
||||
clientOptions,
|
||||
} = options;
|
||||
|
||||
const { sessionSupportsH264High, transcodeWidth, isMediumResolution } = parseOptions(clientOptions);
|
||||
const { sessionSupportsH264High, transcodeWidth, isMediumResolution, width, height } = parseOptions(clientOptions);
|
||||
|
||||
let transcodeBaseline = maximumCompatibilityMode;
|
||||
// const transcodeBaseline = !sessionSupportsH264High || maximumCompatibilityMode;
|
||||
@@ -64,8 +64,8 @@ export async function createTrackForwarder(options: {
|
||||
const mo = await requestMediaStream({
|
||||
video: {
|
||||
codec: 'h264',
|
||||
width: clientOptions?.screen?.width,
|
||||
height: clientOptions?.screen?.height,
|
||||
width,
|
||||
height,
|
||||
},
|
||||
audio: {
|
||||
codec: 'opus',
|
||||
@@ -323,8 +323,8 @@ export function parseOptions(options: RTCSignalingOptions) {
|
||||
const transcodeWidth = Math.max(640, Math.min(options?.screen?.width || 960, 1280));
|
||||
const width = options?.screen?.width;
|
||||
const height = options?.screen?.height;
|
||||
const max = Math.max(width, height);
|
||||
const isMediumResolution = max && max < 1920;
|
||||
const max = Math.max(width, height) * options?.screen?.devicePixelRatio;
|
||||
const isMediumResolution = !sessionSupportsH264High || (max && max < 1920);
|
||||
|
||||
// firefox is misleading. special case that to disable transcoding.
|
||||
if (options?.userAgent?.includes('Firefox/'))
|
||||
@@ -334,6 +334,8 @@ export function parseOptions(options: RTCSignalingOptions) {
|
||||
sessionSupportsH264High,
|
||||
transcodeWidth,
|
||||
isMediumResolution,
|
||||
width: isMediumResolution ? 1280 : width,
|
||||
height: isMediumResolution ? 720 : height,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user