1.0.0 • Published 4 years ago

react-native-bb-bkgd-controls v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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();