AirPlay
AirPlay is a proprietary wireless streaming technology developed by Apple Inc. that allows you to play audio, video, and other media content from one Apple device to another, such as from an iPhone to a HomePod speaker or from a Mac to an Apple TV. AirPlay also allows you to mirror the display of your device on a compatible TV or projector.
AirPlay is enabled on Lura Player by default. You can disable AirPlay with following config.
Attribute | Type | Optional | Description |
---|---|---|---|
enabled | boolean | true | Whether casting is enabled in available devices. (Defaults to false) |
import React, { useRef, useEffect, useState } from "react";
import { SafeAreaView, StyleSheet, View } from "react-native";
import { LuraPlayer, type UnifiedPlayer, type Configuration } from "@akta-tech/lura-player-react-native";
import { LuraPlayerControls } from "@akta-tech/lura-player-react-native-ui";
export default function App() {
const playerRef = useRef<UnifiedPlayer>(null);
const config: Configuration = {
...
cast: {
airplay: {
enabled: true
}
},
...
};
useEffect(() => {
playerRef.current?.setConfig(config)
}, [playerRef]);
return (
<View>
<SafeAreaView />
<LuraPlayer ref={playerRef} style={styles.player}>
<LuraPlayerControls></LuraPlayerControls>
</LuraPlayer>
</View>
);
}
const styles = StyleSheet.create({
player: {
backgroundColor: "#000",
width: "100%",
maxWidth: 640,
aspectRatio: 16 / 9,
},
});