我尝试为我的项目使用 https://github.com/tanguyantoine/react-native-music-control 包,但每次我发现错误: setShowActionsInCompactView: action 0 out of bounds (max -1)
我的代码来自演示应用程序:
MusicControl.enableBackgroundMode(true);
MusicControl.setNowPlaying({
title: 'Billie Jean',
artwork: 'https://i.imgur.com/e1cpwdo.png',
artist: 'Michael Jackson',
album: 'Thriller',
genre: 'Post-disco, Rhythm and Blues, Funk, Dance-pop',
duration: this.whoosh.getDuration(),
description: 'Billie Jean is a song by American singer Michael Jackson. It is the second single from the singer's sixth solo album, Thriller (1982). It was written and composed by Jackson and produced by Jackson and Quincy Jones.',
date: '1983-01-02T00:00:00Z',
rating: 84
})
MusicControl.enableControl('play', false)
MusicControl.enableControl('pause', true)
我已将代码简化为简单调用:
MusicControl.setNowPlaying({
title: 'Billie Jean',
})
但错误仍在抛出。然后我尝试按原样运行演示项目 https://github.com/tanguyantoine/react-native-music-control-demo,再次失败并出现相同的错误
我发现很多项目都使用这个包,我的代码很熟悉。谁能给我一个提示,我在哪里犯了错误?
损坏的电流包版本 - 0.9.8
讨论 https://github.com/tanguyantoine/react-native-music-control/issues/230