tanguyantoine / react-native-music-control

Display and manage media controls on lock screen and notification center for iOS and Android.
https://www.npmjs.com/package/react-native-music-control
MIT License
697 stars 264 forks source link

Album Artwork not showing on IOS #399

Open alcolopa opened 2 years ago

alcolopa commented 2 years ago

Hello,

I am trying to add an artwork to the media that is being played when our app is playing, we only use one artwork for all of our playing times for the meantime since it's a radio app.

The following code is used to display an icon, it works on simulator but it doesn't seem to work on a real device.

We are using a webview with a stream as a player and visualizer.

Description

I have followed the instructions for both iOS and Android and the controls work perfectly fine, I have added the capabilities needed for this package to run on the iOS Side

Code Used:

import MusicControl, { Command } from 'react-native-music-control';

const logo = 'https://i.imgur.com/e1cpwdo.png';

  componentDidMount() {
    MusicControl.enableBackgroundMode(true);
    MusicControl.handleAudioInterruptions(true);

    MusicControl.on(Command.play, () => {
      this.toggleAudio();
    })

}

  toggleAudio = () => {
    if (!this.state.isInitialized) {
      MusicControl.setNowPlaying({
        title: 'Belight FM',
        artwork: logo, // URL or RN's image require()
        artist: '105.7',
        color: 0xffffff, 
        colorized: true, 
        isLiveStream: true,
        elapsedTime: 0,
      })
      MusicControl.enableControl('play', true)
      MusicControl.enableControl('pause', true)
      MusicControl.enableControl('skipBackward', true, { interval: 10 })
      MusicControl.enableControl('skipForward', true, { interval: 10 })
      this.setState(prevState => ({
        isInitialized: !prevState.isInitialized
      }));
    }
  1. Platform ?

    • [x] iOS
    • [ ] Android
  2. Device

    • [ ] Simulator
    • [x] Real device