3

I'm building an app that streams two-player at the same time. My sources are react-native-video and react-native-youtube-iframe. I implement react-native-music-control to react-native-video and it works perfectly until youtube-iframe starts. When youtube starts, music control disappears on the notification itself and I don't wanna do that. Is there any option to force keep live? btw artwork also doesn't work but it's not important for now.

const { data, streamer, duration } = this.state;
MusicControl.enableControl("play", true);
MusicControl.enableControl("pause", true);
MusicControl.enableControl("stop", true);
MusicControl.enableControl("seekForward", true); // iOS only
MusicControl.enableControl("seekBackward", true); // iOS only

MusicControl.setNowPlaying({
  title: data.name,
  artwork: "https://via.placeholder.com/250x250?text=" + data.name,
  artist: streamer.name,
  duration: duration, // (Seconds)
  description: "Description", // Android Only
  color: 0xffffff, // Notification Color - Android Only
  date: "1983-01-02T00:00:00Z", // Release Date (RFC 3339) - Android Only
  rating: 84, // Android Only (Boolean or Number depending on the type)
});
MusicControl.enableBackgroundMode(true);
MusicControl.handleAudioInterruptions(true);
MusicControl.on("play", () => {
  this.handleMainButtonTouch();
});
MusicControl.on("pause", () => {
  this.handleMainButtonTouch();
});
MusicControl.on("seekForward", () => {
  this.jumpSeconds(10);
});
MusicControl.on("seekBackward", () => {
  this.jumpSeconds(-10);
});

Platform?

  • [x] iOS
  • [x] Android

Device/Simulator

  • [x] Real device
ridvanaltun
  • 2,595
  • 2
  • 15
  • 28
mtalha
  • 396
  • 1
  • 3
  • 11

0 Answers0