simplify_web_suite_core icon indicating copy to clipboard operation
simplify_web_suite_core copied to clipboard

MESSAGE_DID_CHANGE_PLAYBACK_STATE key type mismatch

Open duncanbeevers opened this issue 9 years ago • 0 comments

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.

duncanbeevers avatar May 11 '16 21:05 duncanbeevers