xat / castnow

commandline chromecast player
MIT License
3.81k stars 243 forks source link

TypeError: Cannot read property 'playerState' of undefined #80

Closed redM0nk closed 9 years ago

redM0nk commented 9 years ago

On running: castnow 'video file - mp4/avi/' --device "device name" It is giving me the following error on terminal; while my TV screen just flashes and then shows a chromecast logo in the center.

/usr/local/lib/node_modules/castnow/node_modules/chromecast-player/api.js:21 that.emit(status.playerState.toLowerCase(), status); ^ TypeError: Cannot read property 'playerState' of undefined at RequestResponseController.onMessage (/usr/local/lib/node_modules/castnow/node_modules/chromecast-player/api.js:21:23) at RequestResponseController.emit (events.js:117:20) at Channel.onmessage (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/lib/controllers/controller.js:16:10) at Channel.emit (events.js:98:17) at Client.onmessage (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/channel.js:23:10) at Client.emit (events.js:117:20) at PacketStreamWrapper.onpacket (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/client.js:79:10) at PacketStreamWrapper.emit (events.js:95:17) at CleartextStream. (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/packet-stream-wrapper.js:28:16) at CleartextStream.emit (events.js:92:17)

Any help is appreciated. Thanks.

redM0nk commented 9 years ago

terminal output with DEBUG=castnow* flag

castnow launching... +0ms castnow:localfile started webserver on address 10.0.0.7 using port 4100 +4ms castnow player status: loading plugins +1ms castnow player status: scanning +0ms castnow player status: connecting +2s castnow player status: launching +129ms castnow player status: loading +1s

/usr/local/lib/node_modules/castnow/node_modules/chromecast-player/api.js:21 that.emit(status.playerState.toLowerCase(), status); ^ TypeError: Cannot read property 'playerState' of undefined at RequestResponseController.onMessage (/usr/local/lib/node_modules/castnow/node_modules/chromecast-player/api.js:21:23) at RequestResponseController.emit (events.js:117:20) at Channel.onmessage (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/lib/controllers/controller.js:16:10) at Channel.emit (events.js:98:17) at Client.onmessage (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/channel.js:23:10) at Client.emit (events.js:117:20) at PacketStreamWrapper.onpacket (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/client.js:79:10) at PacketStreamWrapper.emit (events.js:95:17) at CleartextStream. (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/packet-stream-wrapper.js:28:16) at CleartextStream.emit (events.js:92:17)

karlpokus commented 9 years ago

Same thing here I think. Trying to stream a magnet link.

castnow #magnet_link#

Error msg:

/usr/local/lib/node_modules/castnow/node_modules/chromecast-player/api.js:21 that.emit(status.playerState.toLowerCase(), status); ^ TypeError: Cannot read property 'playerState' of undefined at RequestResponseController.onMessage (/usr/local/lib/node_modules/castnow/node_modules/chromecast-player/api.js:21:23) at RequestResponseController.emit (events.js:129:20) at Channel.onmessage (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/lib/controllers/controller.js:16:10) at Channel.emit (events.js:110:17) at Client.onmessage (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/channel.js:23:10) at Client.emit (events.js:129:20) at PacketStreamWrapper.onpacket (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/client.js:79:10) at PacketStreamWrapper.emit (events.js:107:17) at TLSSocket. (/usr/local/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/packet-stream-wrapper.js:28:16) at TLSSocket.emit (events.js:104:17)

Inf3rnus187 commented 9 years ago

Hi !!

I had the same issue only on streaming uri as mp4.

I try many stuff nothing was working... And just restarting the chromecast solved this ;)

redM0nk commented 9 years ago

@Inf3rnus187 So Chromecast was the culprit and restarting it solved the problem. Thanks. @karlpokus Please try restarting the Chromecast. If it works then please go ahead and close the issue.

karlpokus commented 9 years ago

@Inf3rnus187 @redM0nk Well the restart kinda worked. I got no error msg but all I got was a loading screen and then chomecast switched to wallpaper mode. Could be a problem related to the magnet link tho. Sure let's close this issue.

edit: Sorry don't know how to close it :(

xat commented 9 years ago

@karlpokus try castnow "#magnet_link#" (double quotes)

karlpokus commented 9 years ago

@xat Sorry. Double quotes didn't work either. Keeps loading. No error messages but I can quit by ctrl + c (didn't work before). Tricky these URI:s. Should I maybe use the entire string including dm, & etc?

redM0nk commented 9 years ago

@karlpokus The magnet link you have is taking too long to stream. I don't know the reason. I tried to play it locally using peerflix but it gave me the same problem (taking too long to stream - may be it doesn't have enough peers?) So I tried it with another link and it works like a charm.

castnow "#other_magnet_link#"

Please see if this link works on your system.

xat commented 9 years ago

Fixed in v0.4.13. Restarting Chromecast shouldn't be needed anymore.

@karlpokus like redM0nk suggests, I also think it's a problem with the torrent source in your case.

xat commented 9 years ago

I'll strip out the torrent links in this issue ( just to be on the save side :) ).

karlpokus commented 9 years ago

Great! How do I update to v0.4.13?

npm install -g castnow only updates to 0.4.12 npm view castnow version shows 0.4.13

xat commented 9 years ago

strange, should work. maybe try npm update -g castnow

karlpokus commented 9 years ago

Is update -g safe now? I've accidentally erased npm this way. Not fun uninstalling node manually.