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

Status always null Sender.GetChannel<IMediaChannel>().Status #2

Closed
roberthardesty opened this issue Sep 2, 2017 · 5 comments
Closed

Comments

@roberthardesty
Copy link

Greetings!

First off this is an awesome project, very modern and clean code. I am working on a .Net Core 2.0 Console service that utilizes MQTT for communications and acts as a hub for much of my home automation. I've been attempting to add a chromecast project to the service that utilizes this library. Using the example provided I've been able to connect and Play media, however, before attempting to execute other commands such as PauseAsync() and StopAsync() I check an IsStopped boolean just like in the example.

 public bool IsStopped
        {
            get
            {
                var mediaChannel = _sender?.GetChannel<IMediaChannel>();
                return (mediaChannel?.Status == null || !String.IsNullOrEmpty(mediaChannel.Status.FirstOrDefault()?.IdleReason));
            }
        }

When doing so the mediaChannel.Status is always null.
When I do _sender.GetStatuses() I get two entries in the Dictionary. One with Key = "urn:x-cast:com.google.cast.receiver" and the other Key = "urn:x-cast:com.google.cast.media" both with null values.

Is there something I'm missing that's happening in the example?

@kakone
Copy link
Owner

kakone commented Sep 4, 2017

Strange... It should not be null when the media is playing. When you call the PlayAsync() method, what is the result of the async operation (it should return a not null MediaStatus) ?

@Marcus-L
Copy link
Contributor

@roberthardesty - are you checking IsStopped from a different client/sender than you are starting the media playing from? (or different thread?)

If you are, then Status will be null. I submitted PR #7 which allows you to call GetStatusAsync() on the receiver channel to get the receiver status from a different client, which may help you if this is the case.

@kakone
Copy link
Owner

kakone commented Sep 18, 2017

Now, there are some GetStatusAsync methods on the ReceiverChannel (and also on the MediaChannel but I forgot to test it). You can call these methods to really know the current status.

@ghost
Copy link

ghost commented Oct 29, 2017

When I call GetStatusAsync, the method never returns (and throw a Timeout exception after a long time).

@kakone
Copy link
Owner

kakone commented Sep 16, 2018

Fixed in version 1.6.4.

@kakone kakone closed this as completed Sep 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants