New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@scrypted/chromecast

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scrypted/chromecast - npm Package Compare versions

Comparing version

to
0.0.7

2

package.json
{
"name": "@scrypted/chromecast",
"version": "0.0.6",
"version": "0.0.7",
"description": "Send video, audio, and text to speech notifications to Chromecast and Google Home devices",

@@ -5,0 +5,0 @@ "author": "Scrypted",

@@ -8,3 +8,3 @@ const fs = require('fs');

const Client = require('castv2-client').Client;
const DefaultMediaReceiver = require('castv2-client').DefaultMediaReceiver;
const DefaultMediaReceiver = require('castv2-client').DefaultMediaReceiver;
import memoizeOne from 'memoize-one';

@@ -17,41 +17,48 @@

CastDevice.prototype.sendMedia = function (title, mediaUrl, mimeType) {
var client = new Client();
CastDevice.prototype.sendMediaToClient = function (title, mediaUrl, mimeType) {
this.client.launch(DefaultMediaReceiver, function (err, player) {
var media = {
client.connect(this.host, function () {
console.log('connected, launching app ...');
// Here you can plug an URL to any mp4, webm, mp3 or jpg file with the proper contentType.
contentId: mediaUrl,
contentType: mimeType,
streamType: 'BUFFERED', // or LIVE
client.launch(DefaultMediaReceiver, function (err, player) {
var media = {
// Title and cover displayed while buffering
metadata: {
type: 0,
metadataType: 0,
title: title,
}
};
// Here you can plug an URL to any mp4, webm, mp3 or jpg file with the proper contentType.
contentId: mediaUrl,
contentType: mimeType,
streamType: 'BUFFERED', // or LIVE
player.on('status', function (status) {
console.log('status broadcast playerState=%s', status.playerState);
});
// Title and cover displayed while buffering
metadata: {
type: 0,
metadataType: 0,
title: title,
}
};
console.log('app "%s" launched, loading media %s ...', player.session.displayName, media.contentId);
player.on('status', function (status) {
console.log('status broadcast playerState=%s', status.playerState);
});
player.load(media, { autoplay: true }, function (err, status) {
console.log('media loaded playerState=%s', status.playerState);
});
});
}
console.log('app "%s" launched, loading media %s ...', player.session.displayName, media.contentId);
CastDevice.prototype.sendMedia = function (title, mediaUrl, mimeType) {
if (this.client) {
console.log('reusing client')
this.sendMediaToClient(title, mediaUrl, mimeType);
return;
}
player.load(media, { autoplay: true }, function (err, status) {
console.log('media loaded playerState=%s', status.playerState);
});
this.client = new Client();
});
this.client.connect(this.host, () => {
this.sendMediaToClient(title, mediaUrl, mimeType);
});
client.on('error', function (err) {
this.client.on('error', (err) => {
console.log('Error: %s', err.message);
client.close();
this.client.close();
delete this.client;
});

@@ -80,6 +87,6 @@ }

mediaConverter.convert(media, mimeType)
.to('android.net.Uri', mimeType)
.setCallback((e, result) => {
this.sendMedia(title, result.toString(), mimeType);
});
.to('android.net.Uri', mimeType)
.setCallback((e, result) => {
this.sendMedia(title, result.toString(), mimeType);
});
}

@@ -86,0 +93,0 @@

Sorry, the diff of this file is too big to display