Integrate with opentok-react
Closed this issue ยท 6 comments
sfmendes91 commented
How can i integrate this package using the opentok-react library also?
I'm generating the streams like this, by using components from Opentok-react.
<OTStreams>
<OTSubscriber
ref={this.props.setRef}
properties={{
subscribeToAudio: this.props.audio,
subscribeToVideo: this.props.video,
style: { buttonDisplayMode: 'off' }
}}
/>
</OTStreams>
immikimaru commented
Would be perfect !
leonardolouie commented
@sfmendes91 how ?
sivachandranraina commented
@aullman
anyone explain or help me in integrating this layoutjs with Opentok-react?
@immikimaru which one is perfect here, I didn't get you!
I am generating the subscribers with the below code
Where to wrapup this following block with the layoutContainer thing as per the layout documentation
{stream.map((data) => (
<div key={data.id}>
<OTSubscriber
session={sessionHelper.session}
stream={data} className="subscriber-video-stream"
properties={{ showControls: false }}
eventHandlers={subscriberEventHandlers} />
</div>
))}
telltokichu commented
Me too facing the same Issue
aullman commented
Sorry for the late response. You should be able to use the getLayout method to get the layout and then set the position of the OTSubscriber with inline styles. Something like:
const layout = initLayoutContainer(options);
const boxes = layout.getLayout(this.state.streams.map(stream => {
width: stream.videoDimensions.width,
height: stream.videoDimensions.height,
big: stream.videoType === 'screen',
});
return ({this.state.streams.map((stream, idx) => (
<div key={stream.id} style={{top: boxes[idx].top, left: boxes[idx].left, width: boxes[idx].width, height: boxes[idx].height }}>
<OTSubscriber
session={sessionHelper.session}
stream={stream} className="subscriber-video-stream"
properties={{ showControls: false }}
eventHandlers={subscriberEventHandlers} />
</div>
))}