This repository was archived by the owner on Oct 6, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 268
Error on iOS updatePlayback State #346
Comments
Hi @leomiranda-tc I'm using this in production and it does work. Can you elaborate? What version of react native? etc. |
If you want, i can share my repository with you @bradleyflood. But the details is bellow:
That's the code part: import MusicControl from 'react-native-music-control';
import actionsVideo from '../store/actions/index';
import { useDispatch } from 'react-redux'
import {
Platform,
} from 'react-native';
const MusicControls = () => {
const dispatch = useDispatch()
const config = () => {
// Basic Controls
MusicControl.enableControl('play', true)
MusicControl.enableControl('pause', true)
MusicControl.enableBackgroundMode(true);
MusicControl.handleAudioInterruptions(true);
// Controls events
MusicControl.on('pause', ()=> {
dispatch(actionsVideo.pausedChange(true))
MusicControl.updatePlayback({ state: MusicControl.STATE_PAUSED })
})
MusicControl.on('play', ()=> {
dispatch(actionsVideo.pausedChange(false))
MusicControl.updatePlayback({ state: MusicControl.STATE_PLAYING })
})
}
const close = () => {
MusicControl.resetNowPlaying()
}
const set = (title) => {
MusicControl.setNowPlaying({
title: title,
artwork: require('../assets/tc-logo.png'),
})
MusicControl.updatePlayback({ state: MusicControl.STATE_PLAYING })
}
return {config, close, set}
}
export default MusicControls; |
Similar issue on iOS. For us, it is not that it doesn't work at all. But Is there a way to get current state of the playback? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
This command line only works on android.
Platform ?
The text was updated successfully, but these errors were encountered: