AndroidChromecastSDK (Xamarin Bindings):Getting the RemoteMediaPlayer.MediaStatus always return null

Hey guys, I'm having a hard time using the RemoteMediaPlayer. I am able to successfully send a song to my chromecast device and make it play on my TV, but when I try to stop it. I get a InvalidMediaSession exception since there is no current media session, but the song is being played so I'm a little confused here. I've isolated the problem to the callbacks on RemoteMediaPlayer not being called when they should (if i compare my code to some Android apps (written in Java)).

Even if i call the method SetOnStatusUpdatedListener on my RemoteMediaPlayer, the callback is never called. Even if i call RequestStatus on the RemoteMediaPlayer, the callback is never called. I have 3 possible callbacks that can be called (OnStatusUpdated, OnMetadataUpdated and OnResult (when I call the Load method)) and none of them are ever called so I'm beginning to think that there could be a problem with the bindings on the callbacks for the RemoteMediaPlayer class but I cannot be certain.

You can see more details here.

By the way, this is how it works in Java :

mRemoteMediaPlayer = new RemoteMediaPlayer();
mRemoteMediaPlayer.setOnStatusUpdatedListener(new RemoteMediaPlayer.OnStatusUpdatedListener() {
@Override
public void onStatusUpdated() {
MediaStatus mediaStatus = mRemoteMediaPlayer.getMediaStatus();
isPlaying = mediaStatus.getPlayerState() == MediaStatus.PLAYER_STATE_PLAYING;
}
});

And it is exactly the way I do it in C# but the OnStatusUpdated method never gets called whether my song is Buffering, Idle or Playing which I know for a fact happens because I see the result on my TV.

Some help is appreciated and I can provide any additionnal information if needed.

Thanks a lot.

Sign In or Register to comment.