Skip to content

Commit

Permalink
Fix double events & stop not working when switching track
Browse files Browse the repository at this point in the history
That PlayImpl in the set status made no sense to me. Gone now

Also js has to unbind when leaving the page. Gross
  • Loading branch information
cbaggers committed Aug 8, 2017
1 parent c006c74 commit 48eeeaa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
9 changes: 5 additions & 4 deletions Examples/Basics/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ var itemClicked = function(item) {

var backClicked = function() {
StreamingPlayer.stop();
StreamingPlayer.removeAllListeners();
router.goto("artists");
};

StreamingPlayer.on("currentTrackChanged", function() {
console.log("Track Changed: " + JSON.stringify(StreamingPlayer.currentTrack));
StreamingPlayer.on("currentTrackChanged", function(track) {
console.log("Track Changed: " + JSON.stringify(track));
});

StreamingPlayer.on("statusChanged", function() {
console.log("Status Changed: " + JSON.stringify(StreamingPlayer.status));
StreamingPlayer.on("statusChanged", function(status) {
console.log("Status Changed: " + JSON.stringify(status));
});

module.exports = {
Expand Down
12 changes: 3 additions & 9 deletions src/iOS/StreamingPlayer.uno
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,13 @@ namespace StreamingPlayer
}
private set
{
var orig = Status;
var orig = _status;
_status = value;

if (_internalState == iOSPlayerState.Initialized
&& (_internalState == iOSPlayerState.Unknown || Status == PlayerStatus.Stopped))
{
PlayImpl(_player);
}

var handler = StatusChanged;
if (handler != null && (Status != orig))
if (handler != null && (_status != orig))
{
handler(Status);
handler(_status);
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions todo
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
Hmm I think we can just use forward always. As then when in history it just works and
when there is no history then it uses the playlist. Cool!

- ios: double play on switch track

## Done

I: Forward works even when no history
Expand Down Expand Up @@ -117,4 +115,7 @@ I: add 'set current track'
R: -

I: add clear history
R: -
R: -

I: ios - double play on switch track
R: two issues, playimpl in set status & bad use of status from JS

0 comments on commit 48eeeaa

Please sign in to comment.