I'm building a Chromecast Sender application and I can successfully cast a session. However I can only cast once. When I disconnect my sessionListener callback never fires, which is problematic because that is where I set my sessionUpdate
listener. Without that it is not possible to tell when a session ends in order to reset the session and do any clean up, which means I can't recast anything because I have no way of knowing if a session is valid or not.
As far as I can tell the problem is in cast_sender.js
which is conveniently obfuscated so I could be wrong.
I'm setting up my ApiConfig as follows:
apiConfig = new _chrome.cast.ApiConfig(
sessionRequest,
_sessionListener.bind(this),
_receiverListener.bind(this));
_receiverListener
is fired as expected and I have debugged cast_sender.js
to the point where I can see my function _sessionListener
being passed in and set properly on line #837 of cast_sender.js
, here:
835 chrome.cast.dd = function(a, c, d, e, f) {
836 this.sessionRequest = a;
837 this.sessionListener = c;
838 this.receiverListener = d;
839 this.autoJoinPolicy = e || chrome.cast.Fb.TAB_AND_ORIGIN_SCOPED;
840 this.defaultActionPolicy = f || chrome.cast.Jb.CREATE_SESSION;
841 this.customDialLaunchCallback = null;
842 };
that function appears to be called on line #2441, here:
2440 b.Wf = function(a) {
2441 this.B && this.B.sessionListener(a.message);
2442 };
I have set a breakpoint there and it is never called. At this point I have reached an impasse, any thoughts?