Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

closing when another music starts #331

Closed
1 task
mtalhagaoglu opened this issue Jun 3, 2020 · 4 comments
Closed
1 task

closing when another music starts #331

mtalhagaoglu opened this issue Jun 3, 2020 · 4 comments

Comments

@mtalhagaoglu
Copy link

Hi. I'm building an app streams two player at the same time. My sources are react-native-video and react-native-youtube-iframe. I implement music control to react-native-video and it works percfectly until youtube-iframe starts. When youtube start, music control closes 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.

  1. Sample code (provide repo url or sample code)
    `
    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);
    });`

  1. Platform ?

    • [ x] iOS
    • [ x] Android
  1. Device
  • Simulator
  • [ x] Real device
@bradfloodx
Copy link
Collaborator

hi @mtalhagaoglu a question like this is best posted on Stack Overflow.
If you have found a specific bug with react-native-music-control please post a reproducible demo of that bug. But logic and issues with your own project setup we can't help with.

Sorry :(

Cheers
Brad

@HasanAlyazidi
Copy link

Same issue even with v0.12.0

Audio does not pause no matter what.

I tried the following with no success:

MusicControl.handleAudioInterruptions(true);

Thank you

@bradfloodx
Copy link
Collaborator

Hi @HasanAlyazidi and @mtalhagaoglu

I'm not sure what your issue is? Are you saying that the handleAudioInterruptions(true) method doesn't work? Because it does for me on my app.

If you can provide a reproducible demo that would be very helpful. Thank you.

@HasanAlyazidi
Copy link

if handleAudioInterruptions(true) is supposed to stop/pause when currently playing audio is interrupted by a call or any other audio, yes i confirm that it does not work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants