首页 > 解决方案 > 捕获错误 - setShowActionsInCompactView

问题描述

我尝试为我的项目使用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并且我再次失败并出现同样的错误

我发现很多项目都使用这个包,而且我的代码很熟悉。任何人都可以给我一个提示我犯错的地方吗?

标签: react-native

解决方案


损坏的当前软件包版本 - 0.9.8

讨论https://github.com/tanguyantoine/react-native-music-control/issues/230


推荐阅读