Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
fix for reconnect fail (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jey-Cee committed Jan 13, 2022
1 parent 1e1a092 commit 196d3d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/persistentClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ module.exports = function (logClass) {
const CONNECTION_TIMEOUT = 10000; //Time to wait for connection before failing a connection promise

//Includes
var Client = require('castv2-client').Client;
var EventEmitter = require('events').EventEmitter;
const Client = require('castv2-client').Client;
const EventEmitter = require('events').EventEmitter;

var log = logClass ? logClass : require("./dummyLogClass")("PersistentClient");
let log = logClass ? logClass : require("./dummyLogClass")("PersistentClient");

class PersistentClient extends EventEmitter {

Expand Down Expand Up @@ -249,7 +249,7 @@ module.exports = function (logClass) {
that._connecting_client = undefined;

//If connection closes afterwards then re-open it again
that._client.once("close", function(){
that._client.client.once("close", function(){
that._close();
that._connectClient();
});
Expand Down
3 changes: 1 addition & 2 deletions lib/persistentPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,7 @@ module.exports = function (logClass) {
that._status &&
(that._status.playerState == "PLAYING") &&
(that._previousStatus === undefined || that._status.playerState != that._previousStatus.playerState)
)
{
) {
if (that._status.media) {
that.emit(that.EVENT_PLAYING, that._status.media.contentId);
log.info("%s - Playing - %s", that._name, that._status.media.contentId);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "castv2-player",
"version": "2.1.0",
"version": "2.1.1",
"description": "A Chromecast client based on the new (CASTV2) protocol",
"author": "angelnu",
"license": "MIT",
Expand Down

0 comments on commit 196d3d1

Please sign in to comment.