A declarative stream player for agora-rtc-sdk
- Declarative stream player controlling stream by props
- Display placeholder for stream without video track
- Label and decorations for stream
- Network Detector to show network status with icon
- Two display mode: cover and contain
- High test coverage
npm install agora-stream-player
App.js
import StreamPlayer from 'agora-stream-player'
import AgoraRTC from 'agora-rtc-sdk'
class Demo extends Component {
state = {
stream: null
}
componentDidMount() {
let stream = AgoraRTC.createStream({
streamID: 1024,
video: true,
audio: true
})
stream.init(() => {
this.setState({
stream
})
})
}
render() {
return (
{/** You'd better use conditional render to make it mount/unmount properly */}
{this.state.stream && <StreamPlayer
key={1024}
video={true}
audio={true}
stream={this.state.stream}
fit="contain"
label="A stream"
/>}
)
}
}
Agora stream created by local or subscribed from remote
Enable video or not
Enable audio or not
Whether to automatically solve side effects for audio & video, default to be true
Use cover or contain display mode
Detect network status periodically and show an icon
Mark the speaker with an icon
Add more custom icons etc
Add more custom icons etc
Add custom placeholder to replace default one
Show some description for the stream
className
style
click event
dblclick event
npm install
npm run start
npm run build
npm run test
npm run test:coverage