Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

An airplay button with availability and connection listeners

Notifications You must be signed in to change notification settings

gazedash/react-native-airplay-btn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-airplay-btn

AirPlay library for iOS

Project moved

This project is now located at https://github.com/gazedash/react-native-airplay-ios

Installation with Automatic Linking

npm i react-native-airplay-btn --save
react-native link

How to create listeners

import { AirPlayListener } from react-native-airplay-btn

this.airPlayConnected = AirPlayListener.addListener('deviceConnected', ({ devices }) => this.setState({
    devices,
})); --> returns a boolean


// Remove Listener in componentWillUnmount
this.deviceConnected.remove();

Devices is an array of objects that contains information about currently connected audio output(s):

[{deviceName: "Some Bluetooth Headphones Model", portType: "BluetoothA2DPOutput"}]
// or
[{deviceName: "Speakers", portType:"Speakers"}]
// or
[{deviceName: "Andrey’s Apple TV", portType: "AirPlay"}]

Probably it could just be an object, but internally AVAudioSessionRouteDescription returns array, so there might be a case when there is more than one device connected at the time.

Methods

  AirPlay.startScan();
  
  AirPlay.disconnect();

Create AirPlay Button

import { AirPlayButton } from 'react-native-airplay-btn';

<Button style={{ height: 30, width: 30, justifyContent: 'center', alignItems:'center' }} />

Note: The AirPlay Button does not show in the simulator

Author

Original author of the library:

Nadia Dillon

Modifications:

Andrey Efremov (gazedash)

About

An airplay button with availability and connection listeners

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 31.3%
  • Objective-C 22.1%
  • Swift 20.5%
  • Python 12.7%
  • Java 7.9%
  • Ruby 4.7%
  • C 0.8%