Fixes bug where castSession is null when calling castSession.loadMedia()
When the ChromeCast player state reaches an IDLE state, a timeout will start to close the session after SESSION_TIMEOUT (default is 10 seconds) has elapsed.
After calling _playSource() this close session timeout is cleared. However, when playing a new source, the player state will go from PAUSED → IDLE → BUFFERING → PLAYING.
There is a listener for the IDLE state that starts the close session timeout. With the current order of player state changes, this could cause the casting session to close while the new source is being played, even if we are in the PLAYING state.
To prevent this from occurring, we can clear the session timeout when castSession.loadMedia() finishes.
coverage: 2.652% (-0.005%) from 2.657% when pulling 4a8eb31faa241235c54c1f8dec897571360e7f19 on izkmdz:cast-session-null-reference-fix into d7e3c99034f6565b1c9e703b3f34235afb6c5b1e on silvermine:master.
Fixes bug where
castSession
is null when callingcastSession.loadMedia()
When the ChromeCast player state reaches an
IDLE
state, a timeout will start to close the session afterSESSION_TIMEOUT
(default is 10 seconds) has elapsed.After calling
_playSource()
this close session timeout is cleared. However, when playing a new source, the player state will go fromPAUSED
→IDLE
→BUFFERING
→PLAYING
.There is a listener for the
IDLE
state that starts the close session timeout. With the current order of player state changes, this could cause the casting session to close while the new source is being played, even if we are in thePLAYING
state.To prevent this from occurring, we can clear the session timeout when
castSession.loadMedia()
finishes.