-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Any way to select which source to Airplay? #228
Comments
Hey sorry hasn't got time to maintain this library in a while 😅 Do you still have this issue? From what I know, I don't think you manually select the "source". Maybe try the |
@watadarkstar did you have to do any special setup to get AirPlay video to work with I'm experiencing a similar issue where I have a starter Expo app with It's a POC so very bare bones - does the code below look similar to what you have? Thanks in advance for your time! import React, { useRef } from 'react';
import { SafeAreaView, StyleSheet, StatusBar, View, Button, Text } from 'react-native';
import Video, { VideoRef, TextTrackType } from 'react-native-video';
import {
AirplayButton,
showRoutePicker,
useAirplayConnectivity,
useExternalPlaybackAvailability,
useAvAudioSessionRoutes,
} from 'react-airplay';
export const App = () => {
const videoRef = useRef<VideoRef>(null);
const isAirplayConnected = useAirplayConnectivity();
const isExternalPlaybackAvailable = useExternalPlaybackAvailability();
const routes = useAvAudioSessionRoutes();
console.log('IS AIRPLAY CONNECTED:', isAirplayConnected);
console.log('IS EXTERNAL PLAYBACK AVAILABLE:', isExternalPlaybackAvailable);
console.log('ROUTES:', routes);
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView
style={{
flex: 1,
}}
>
<Video
// Store reference
ref={videoRef}
source={{
uri: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
}}
onLoad={(data) => console.log('LOAD:', data)}
// Callback when remote video is buffering
onBuffer={(buffer) => console.log('BUFFER:', buffer)}
// Callback when video cannot be loaded
onError={(error) => console.log('ERROR:', error)}
onExternalPlaybackChange={(e) => console.log('EXTERNAL PLAYBACK:', e)}
style={styles.backgroundVideo}
allowsExternalPlayback={true}
controls={true}
textTracks={[
{
title: 'German',
uri: 'https://images-cdn.getgalatea.com/subtitles/a1e01f33-4889-4ba1-8fdf-7f676934e05e-105-149-1.srt',
type: TextTrackType.SUBRIP,
language: 'de',
},
]}
/>
<View style={{ position: 'absolute', top: 100, left: 100 }}>
{isExternalPlaybackAvailable && (
<>
<AirplayButton
prioritizesVideoDevices={true}
tintColor={'red'}
activeTintColor={'blue'}
style={{
width: 24,
height: 24,
}}
/>
<Button title="Custom Button" onPress={() => showRoutePicker({ prioritizesVideoDevices: true })} />
{routes.length && <Text>Currently playing on {routes.map((route) => route.portName).join(', ')}</Text>}
</>
)}
</View>
</SafeAreaView>
</>
);
};
// Later on in your styles..
const styles = StyleSheet.create({
backgroundVideo: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
zIndex: -1,
},
});
export default App; |
I have an app that is using
react-native-track-player
for audio andreact-native-video
for video. I want the Airplay to use the video when air playing to a device. However, it is currently only playing the audio and not the video.I found that when I comment out this line it plays video:
I want to be able to use my
Video
component from react-native-video for Airplay but for some reason track player is taking priority over the video on the screen.The text was updated successfully, but these errors were encountered: