README
apeman-react-peer
apeman react package for peer components
Installation
$ npm install apeman-react-peer --save
Demo
Live demo is hosted on GitHub Pages.
Usage
'use strict'
import React from 'react'
import ApPeerCamera from '../../lib/ap_peer_camera'
import ApPeerScreen from '../../lib/ap_peer_screen'
import {
ApButton
} from 'apeman-react-basic'
const Demo = React.createClass({
getInitialState () {
return {
streaming: false
}
},
render () {
const s = this
let { state } = s
return (
<div>
<fieldset>
<legend>Video</legend>
<ApPeerCamera peerId="demo-peer-01"
peerOptions={
{
key:'___your_key___'
}
}
peerEnabled={state.streaming}
onError={(err) => console.error(err)}
/>
<ApButton onTap={s._startStreaming}>Start</ApButton>
<ApButton onTap={s._stopStreaming}>Stop</ApButton>
</fieldset>
<fieldset>
<legend>Camera</legend>
<ApPeerScreen peerId="demo-peer-01"
peerOptions={
{
key:'___your_key___'
}
}
peerEnabled={state.streaming}
/>
</fieldset>
</div>
)
},
_startStreaming() {
const s = this
s.setState({ streaming: true })
},
_stopStreaming() {
const s = this
s.setState({ streaming: false })
}
})
export default Demo
Components
ApPeerCamera
Props
Name | Type | Default | Description |
---|---|---|---|
peerId | string | null | |
peerOptions | object | null | |
peerEnabled | bool | false | |
width | number | ApPeerVideo.DEFAULT_WIDTH | |
height | number | ApPeerVideo.DEFAULT_HEIGHT | |
audioEnabled | bool | false | |
onStart | func | null | |
onStop | func | null | |
onConnect | func | null | |
onError | func | null | |
alt | string |
ApPeerScreen
Props
Name | Type | Default | Description |
---|---|---|---|
peerId | string | null | |
peerOptions | object | null | |
peerEnabled | bool | false | |
width | number | ApPeerVideo.DEFAULT_WIDTH | |
height | number | ApPeerVideo.DEFAULT_HEIGHT | |
onError | func | null |
ApPeerStyle
Props
Name | Type | Default | Description |
---|---|---|---|
style | object | {} | |
highlightColor | string | ApStyle.DEFAULT_HIGHLIGHT_COLOR | |
backgroundColor | ApStyle.DEFAULT_BACKGROUND_COLOR |
ApPeerVideo
Props
Name | Type | Default | Description |
---|---|---|---|
width | number | 300 | |
height | number | 150 | |
alt | string | null | |
altIcon | string | 'ion ion-videocamera' | |
spinner | string | ApSpinner.DEFAULT_THEME | |
spinning | bool | false |
License
This software is released under the MIT License.