Host your events virtually and see community interaction as it happens.
In order to play a live stream or recorded live stream using React Native app, we provided AmityStreamPlayer component. This player allows developers to easily incorporate video playback functionality into their applications. To utilize this feature, developers can refer to the example code provided below, which demonstrates how to play the desired video with simplicity and efficiency.
Setup & Configuration
To use AmityStreamPlayer , please follow this setup step in your react native project.
On your live-stream video player page, use AmityStreamPlayer component and pass Amity.Stream .
import {AmityStreamPlayer} from'@amityco/video-player-react-native';import {useRef} from'react';constComponent= ({livestream}: {livestream:Amity.Stream}) => {constref=useRef();// You can implement your own media control and use ref to pause and play the livestreamconstonStopPlayer= () => {ref.current &&ref.current.pause(); };constonStartPlayer= () => {ref.current &&ref.current.play(); };return ( <View> {/* Pass Amity.Stream object as stream prop to AmtiyStreamPlayer */}<AmityStreamPlayer ref={ref} stream={livestream} status={livestream.status} /> {/* You can add your media control compoent here. Since for the live video, AmitStreamPlayer does not provide the media control */}<ControlComponent /></View> );};exportdefault Components;