react-native-bb-bkgd-controls
v1.0.0
Published
React Native Bb Bkgd Controls for iOS
Downloads
1
Maintainers
Readme
react-native-bb-bkgd-controls
This allows you to access the Control Center for iOS. It supports play, pause, skip forward, skip back, setting the thumbnail for 'now playing', and the title of the track.
Getting started
$ npm install react-native-bb-bkgd-controls --save
Mostly automatic installation
$ react-native link react-native-bb-bkgd-controls
Usage
import { BackgroundControls, BackgroundControlsListener } from 'react-native-bb-bkgd-controls';
//initialize command center
BackgroundControls.attachBackgroundControls();
//add listeners
this.playCommand = BackgroundControlsListener.addListener('playVideo', () => this.play());
this.pauseCommand = BackgroundControlsListener.addListener('pauseVideo', () => this.pause());
this.skipForwardCommand = BackgroundControlsListener.addListener('skipForwardVideo', () => this.skipForward());
this.skipBackCommand = BackgroundControlsListener.addListener('skipBackVideo', () => this.skipBackward());
//set 'nowPlaying' info
BackgroundControls.setupNowPlaying({ title: 'BodyFit', imageUrl: { thumbURL });
//remove listeners and detach background controls:
BackgroundControls.detachBackgroundControls();
this.playCommand.remove();
this.pauseCommand.remove();
this.skipForwardCommand.remove();
this.skipBackCommand.remove();