CastMediaStatus.fromChromeCastMediaStatus constructor

CastMediaStatus.fromChromeCastMediaStatus(
  1. Map mediaStatus
)

Implementation

CastMediaStatus.fromChromeCastMediaStatus(Map mediaStatus)
    : _sessionId = mediaStatus['mediaSessionId'],
      _nativeStatus = mediaStatus['playerState'],
      _isIdle = 'IDLE' == mediaStatus['playerState'],
      _isPlaying = 'PLAYING' == mediaStatus['playerState'],
      _isPaused = 'PAUSED' == mediaStatus['playerState'],
      _isMuted = null != mediaStatus['volume'] &&
          true == mediaStatus['volume']['muted'],
      _isLoading = 'LOADING' == mediaStatus['playerState'],
      _isBuffering = 'BUFFERING' == mediaStatus['playerState'],
      _isFinished = 'IDLE' == mediaStatus['playerState'] &&
          'FINISHED' == mediaStatus['idleReason'],
      _isCancelled = 'IDLE' == mediaStatus['playerState'] &&
          'CANCELLED' == mediaStatus['idleReason'],
      _hasError = 'IDLE' == mediaStatus['playerState'] &&
          'ERROR' == mediaStatus['idleReason'],
      _volume = null != mediaStatus['volume']
          ? mediaStatus['volume']['level'].toDouble()
          : null,
      _position = mediaStatus['currentTime'].toDouble(),
      _media = mediaStatus['media'];