Deezer Android SDK - PLAYBACK_COMPLETED在开始播放曲目后立即

时间:2017-02-16 17:48:48

标签: android media-player deezer

我目前在Deezer Android SDK(0.11.1)中遇到以下问题:

  1. 我正在调用TrackPlayer#playTrack。 TrackPlayer贯穿所有预期状态(INITIALIZING - > READY - > WAITING_FOR_DATA - > PLAYING)

  2. 当曲目结束时,正确报告了PLAYBACK_COMPLETED状态。我通过使用新的URI调用TrackPlayer#playTrack来响应,所有预期的PlayerStates都会跟随它。

  3. 但是大约2秒钟后再次调用onPlayerStateChange并报告转换到PLAYBACK_COMPLETED状态,即使该曲目刚刚开始播放。

  4. 日志

    这是显示上述事情的日志:

    02-16 17:51:47.089  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 219132
    02-16 17:51:47.089  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 219132
    02-16 17:51:47.099  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 219132
    02-16 17:51:47.099  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 219132
    02-16 17:51:47.269  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 219355
    02-16 17:51:47.269  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: PLAYBACK_COMPLETED
    02-16 17:51:47.319  22376-22376/com.test D/DeezerService﹕ pause called
    02-16 17:51:47.329  22376-22376/com.test D/DeezerService﹕ prepare called: 65631310
    02-16 17:51:47.749  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: STOPPED
    02-16 17:51:47.749  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: INITIALIZING
    02-16 17:51:47.749  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: READY
    02-16 17:51:47.749  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: WAITING_FOR_DATA
    02-16 17:51:47.829  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: PLAYING
    02-16 17:51:50.109  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2263
    02-16 17:51:50.129  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2263
    02-16 17:51:50.129  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2263
    02-16 17:51:50.129  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.129  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.139  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.139  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.139  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.139  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.139  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.139  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2285
    02-16 17:51:50.289  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2438
    02-16 17:51:50.339  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 145987
    02-16 17:51:50.349  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: PLAYBACK_COMPLETED
    02-16 17:51:50.499  22376-22376/com.test D/DeezerService﹕ pause called
    02-16 17:51:50.499  22376-22376/com.test D/DeezerService﹕ prepare called: 84055801
    02-16 17:51:50.739  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: STOPPED
    02-16 17:51:50.739  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: INITIALIZING
    02-16 17:51:50.739  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: READY
    02-16 17:51:50.739  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: WAITING_FOR_DATA
    02-16 17:51:50.989  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: PLAYING
    02-16 17:51:53.309  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2263
    02-16 17:51:53.479  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2438
    02-16 17:51:53.479  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2438
    02-16 17:51:53.489  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2438
    02-16 17:51:53.489  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2438
    02-16 17:51:53.489  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2438
    02-16 17:51:53.829  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2786
    02-16 17:51:53.829  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2786
    02-16 17:51:53.829  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2786
    02-16 17:51:53.839  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2786
    02-16 17:51:53.839  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2786
    02-16 17:51:53.999  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2960
    02-16 17:51:53.999  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 2960
    02-16 17:51:54.179  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 3134
    02-16 17:51:54.209  22376-22376/com.test D/DeezerService﹕ pause called
    02-16 17:51:54.259  22376-22376/com.test V/DeezerService﹕ onPlayerProgress: 3178
    02-16 17:51:54.259  22376-22376/com.test D/DeezerService﹕ onPlayerStateChange: PAUSED
    

    解决方法

    每次播放新曲目时,都可以通过释放TrackPlayer并创建新曲目来避免此问题。显然,这仅仅是一种解决方法。

0 个答案:

没有答案