din/simplify_web_suite_core

MESSAGE_DID_CHANGE_PLAYBACK_STATE key type mismatch

duncanbeevers opened this issue · 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.