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

Keeping track of media position #59

Open
Rainnwind opened this issue Dec 11, 2016 · 2 comments
Open

Keeping track of media position #59

Rainnwind opened this issue Dec 11, 2016 · 2 comments

Comments

@Rainnwind
Copy link

Hi.

I'm trying to keep track of the position of the played media on the chrome cast but I can't seem to find the proper event to listen on and alternatively I can't see to find a way to extract the position of the media.

Help needed :)

@thibauts
Copy link
Owner

Have you tried subscribing to status updates or calling getStatus ?

@Rainnwind
Copy link
Author

Below is what I've tried with a subscription on status but it only fires when media status changes from IDLE to BUFFERED etc - is this expected behavior?

getStatus on the other hand works like a charm and I'll be using that for now :)

function castVideo(host: string, video: { source: string; type: string; }) {
  var client = new Client();
  var interval;
  client.connect(host, function () {
  client.launch(DefaultMediaReceiver, function (err, player) {
    var media = {
      contentId: video.source,
      contentType: video.type,
      streamType: 'BUFFERED',
      metadata: {
        type: 0,
        metadataType: 0,
        title: "..."
      }
    };
    player.on("status", function (status) {
      console.log(status);
    });
    player.load(media, { autoplay: true }, function (err, status) {
      ...
    });
  });
});

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