Skip to content

Conversation

@vorg
Copy link
Contributor

@vorg vorg commented Dec 13, 2014

Added duration getter for AVPlayer e.g.:

this.audio = new plask.AVPlayer();
this.audio.appendFile('test.mp3');
this.audio.play();
console.log(this.audio.duration());

@deanm
Copy link
Owner

deanm commented Dec 14, 2014

The thing about AVPlayer is that it is a playlist. So duration could mean the duration of the entire playlist, just the current item, etc. Maybe currentDuration, and there could also be a totalDuration?

@vorg
Copy link
Contributor Author

vorg commented Dec 14, 2014

Renaming it to currentDuration in order to match currentTime sounds good. Don't need totalDuration. More useful would be currentTract / totalNumTracks.

@deanm
Copy link
Owner

deanm commented Dec 14, 2014

It's possible that currentItem is nil, see currentLoadedTimeRanges to how to handle that, you should return NULL.

TextureAVPlayer* player = ExtractPlayerPointer(args.This());
AVPlayerItem* item = [player currentItem];
if (item == nil)
  return args.GetReturnValue().SetNull();

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

Successfully merging this pull request may close these issues.

2 participants