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

I just can't understand how it works #36

Closed
GoncaloPT opened this issue Nov 29, 2016 · 6 comments
Closed

I just can't understand how it works #36

GoncaloPT opened this issue Nov 29, 2016 · 6 comments

Comments

@GoncaloPT
Copy link

GoncaloPT commented Nov 29, 2016

Can you please me more specific in docs so everyone can understand how to use it?

In my case the chrome.cast.requestSession always sends an error with CANCEL code:

error: Error { code: 'CANCEL', description: null, details: {} }
whoops! there was an error TypeError: Cannot read property 'substring' of undefined
at _class._normalizeService (/Users/silvagc/Projetos/pessoal/salao/projection_app/node_modules/node-mdns-easy/dist/browser.js:96:57)
at _class.serviceUp (/Users/silvagc/Projetos/pessoal/salao/projection_app/node_modules/node-mdns-easy/dist/browser.js:74:35)
at emitOne (events.js:96:13)
at emit (events.js:188:7)
at internal.onMessage (/Users/silvagc/Projetos/pessoal/salao/projection_app/node_modules/mdns-js/lib/browser.js:109:12)
at emitThree (events.js:116:13)
at emit (events.js:194:7)
at Socket. (/Users/silvagc/Projetos/pessoal/salao/projection_app/node_modules/mdns-js/lib/networking.js:142:10)
at emitTwo (events.js:106:13)
at Socket.emit (events.js:191:7)

@MarshallOfSound
Copy link
Member

Appears to be the same issue as #35

I've never come across it so not sure what could be going wrong. You can however fix the error and PR it in if you want as described in that issue.

@MarshallOfSound
Copy link
Member

In terms of usage, it is identical to the normal chrome.cast API so check out those docs for that. I know it's identical because I dropped it on to Google sites (GPM and YouTube) and it worked flawlessly 😆

@GoncaloPT
Copy link
Author

The problem was related to...... TeamViewer.
Teamviewer was somehow used in the calling of _normalizeService but didnt have all the required arguments ( like fullName for example ).

Altough i'm not having the error going i still get the same message:
error: Error { code: 'CANCEL', description: null, details: {} }

This is the service argument of the _normalizeService function:
{ addresses: [ '192.168.1.71' ], query: [], type: [ { name: 'googlecast', protocol: 'tcp', subtypes: [], description: 'Google Chromecast' } ], txt: [ 'id=290aa972e4d85e3b7536015b42b1b39b', 'rm=44382B7A2F7B494B', 've=05', 'md=Chromecast', 'ic=/setup/icon.png', 'fn=Sala', 'ca=4101', 'st=0', 'bs=FA8FCA571EB1', 'rs=' ], port: 8009, fullname: 'Chromecast-290aa972e4d85e3b7536015b42b1b39b._googlecast._tcp.local', host: '290aa972-e4d8-5e3b-7536-015b42b1b39b.local', interfaceIndex: 1, networkInterface: 'pseudo multicast' }

I don't understand the error...

@MarshallOfSound
Copy link
Member

The only reason we send cancel is if the promise you provide or the default promise throws an exception.

return errorCallback(new chrome.cast.Error(chrome.cast.ErrorCode.CANCEL));

@GoncaloPT
Copy link
Author

GoncaloPT commented Nov 30, 2016

Sure?
`
chrome.cast.requestSession(

    function (session) {

        console.log(session);

    },

    function (error) {

        console.log('error:', error);

     });

`
This is the code i'm running..
I probably have to do something before this but i just can't figure out what.
I have 3 BrowserWindows opened in my app, i just want to cast one of them.

@GoncaloPT
Copy link
Author

GoncaloPT commented Nov 30, 2016

I've realised that i was using the "normal" and the advanced configuration.

My question is, how to i cast one window using the chrome.cast?
The API is huge and i cant find anything related to electron..

http://stackoverflow.com/questions/40894772/using-electron-browserwindow-in-chromecast

Current status:
After i do:

chrome.cast.initialize(chrome.cast.ApiConfig, onInitSuccess, onInitFailure); chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError);
i get:
whoops! there was an error ReferenceError: window is not defined at Client.<anonymous> (/Users/silvagc/Projetos/pessoal/salao/projection_app/node_modules/electron-chromecast/build/cast/_Classes/Session.js:35:7) at Client.g (events.js:286:16) at emitNone (events.js:86:13) at Client.emit (events.js:185:7) at TLSSocket.<anonymous> (/Users/silvagc/Projetos/pessoal/salao/projection_app/node_modules/castv2/lib/client.js:40:10) at TLSSocket.g (events.js:286:16) at emitNone (events.js:86:13) at TLSSocket.emit (events.js:185:7) at TLSSocket.<anonymous> (_tls_wrap.js:1077:16) at emitNone (events.js:86:13) whoops! there was an error { Error: socket hang up at TLSSocket.onHangUp (_tls_wrap.js:1092:19) at TLSSocket.g (events.js:286:16) at emitNone (events.js:91:20) at TLSSocket.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ECONNRESET' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants