ktvPlayer$onPlayStateChanged$state$error method

FutureOr<void> ktvPlayer$onPlayStateChanged$state$error(
  1. ByteRTCKTVPlayer ktvPlayer,
  2. NSString musicId,
  3. ByteRTCPlayState state,
  4. ByteRTCKTVPlayerErrorCode error,
)

@detail callback @author lihuan.wuti2ha @brief 音乐播放状态改变回调。 @param ktvPlayer 当前 ktvPlayer 对象,参看 ByteRTCKTVPlayer{@link #ByteRTCKTVPlayer}。 @param musicId 音乐 ID。 @param state 音乐播放状态,参看 ByteRTCPlayState{@link #ByteRTCPlayState}。 @param error 错误码,参看 ByteRTCKTVPlayerErrorCode{@link #ByteRTCKTVPlayerErrorCode}。 @note 此回调被触发的时机汇总如下:
- 调用 playMusic:audioTrackType:audioPlayType:{@link #ByteRTCKTVPlayer#playMusic:audioTrackType:audioPlayType} 成功后,会触发 playState 值为 ByteRTCPlayStatePlaying 的回调;否则会触发 playState 值为 ByteRTCPlayStateFailed 的回调。 - 使用相同的音乐 ID 重复调用 playMusic:audioTrackType:audioPlayType:{@link #ByteRTCKTVPlayer#playMusic:audioTrackType:audioPlayType} 后,后一次播放会覆盖前一次,且会触发 playState 值为 ByteRTCPlayStatePlaying 的回调,表示后一次音乐播放已开始。 - 调用 pauseMusic:{@link #ByteRTCKTVPlayer#pauseMusic} 方法暂停播放成功后,会触发 playState 值为 ByteRTCPlayStatePaused 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 - 调用 resumeMusic:{@link #ByteRTCKTVPlayer#resumeMusic} 方法恢复播放成功后,会触发 playState 值为 ByteRTCPlayStatePlaying 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 - 调用 stopMusic:{@link #ByteRTCKTVPlayer#stopMusic} 方法停止播放成功后,会触发 playState 值为 ByteRTCPlayStateStoped 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 - 音乐播放结束会触发 playState 值为 ByteRTCPlayStateFinished 的回调。

Implementation

FutureOr<void> ktvPlayer$onPlayStateChanged$state$error(
    ByteRTCKTVPlayer ktvPlayer,
    NSString musicId,
    ByteRTCPlayState state,
    ByteRTCKTVPlayerErrorCode error) async {}