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

MESSAGE_DID_CHANGE_PLAYBACK_STATE key type mismatch #31

Open
duncanbeevers opened this issue May 11, 2016 · 0 comments
Open

MESSAGE_DID_CHANGE_PLAYBACK_STATE key type mismatch #31

duncanbeevers opened this issue May 11, 2016 · 0 comments

Comments

@duncanbeevers
Copy link
Contributor

When receiving the Simplify.MESSAGE_DID_CHANGE_PLAYBACK_STATE message, the data parameter for state does not match the underlying Simplify.PLAYBACK_STATE_PLAYING family of keys.

For example, this simpler handler shows no matching states.

simplify.bind(Simplify.MESSAGE_DID_CHANGE_PLAYBACK_STATE, function (data) {
  var isPlaying = data.state === Simplify.PLAYBACK_STATE_PLAYING;
  var isPaused = data.state === Simplify.PLAYBACK_STATE_PAUSED;
  var isStopped = data.state === Simplify.PLAYBACK_STATE_STOPPED;
  if (isPlaying || isPaused || isStopped) {
    console.log('State recognized');
  } else {
    console.log('State unrecognized');
  }
});

By changing the === operators to the fuzzier == operator, these comparisons work, but I think the data types should match precisely. All strings or all ints, no mixed types please.

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

1 participant