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

MusicControl.updatePlayback({ state: _}) Does Not Work. Playback State Doesn't Change. #395

Open
2 of 4 tasks
franekantoni opened this issue Sep 19, 2021 · 0 comments
Open
2 of 4 tasks

Comments

@franekantoni
Copy link

franekantoni commented Sep 19, 2021

Description

I am using react-native-music-control to pause/play react-native-video player when app is in the background. Controls work fine when app is in the background (the 'pause', 'play' events get handled), but I am unable to change the MusicControl state with tha updatePlayback method-> the icon of music control does not change when MusicControl.updatePlayback gets called. All parts of pausePodcast, playPodcast functions shown below work properly, elapsedTime gets updated, but the MusicControl state does not change. I am running my app on iphone xs ios 14.2

  1. Sample code (provide repo url or sample code)
pausePodcast = () => {
		ReactNativeHapticFeedback.trigger("impactLight", {enableVibrateFallback: true, ignoreAndroidSystemSettings: false})
		this.setState({
			paused: true
		})
		MusicControl.updatePlayback({
		  state: MusicControl.STATE_PAUSED,
		  elapsedTime: this.state.currentTime,
		})
	}

playPodcast = () => {
		ReactNativeHapticFeedback.trigger("impactLight", {enableVibrateFallback: true, ignoreAndroidSystemSettings: false})
		this.setState({
			paused: false
		})
		MusicControl.updatePlayback({
		  state: MusicControl.STATE_PLAYING,
		  elapsedTime: this.state.currentTime,
		})
	}
  1. Platform ?

    • iOS
    • Android
  2. Device

  • Simulator
  • Real device
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

1 participant