react-native-bb-bkgd-controls

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i react-native-bb-bkgd-controls

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

22.9 kB

Total Files

19

Last publish

Collaborators

  • matthew.riley