我尝试为我的项目使用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 :(得分:0)
损坏的当前包装版本-0.9.8
讨论https://github.com/tanguyantoine/react-native-music-control/issues/230