@class100/webrtc
Version:
TODO
31 lines • 2.07 kB
JavaScript
import React, { Component } from 'react';
import { RtcTypes } from '../common/Enums';
import AgoraWebView from './AgoraWebView';
import TRTCWebView from './TRTCWebView';
export default class RtcRemoteView extends Component {
render() {
var _a, _b, _c, _d;
const { rtcType, remoteStream } = this.props;
console.log('RtcRemoteView', this.props);
try {
window[`__WEBRTC_SDK_REMOTE_STREAM_UID_FOR_${remoteStream === null || remoteStream === void 0 ? void 0 : remoteStream.uid}`] = remoteStream;
}
catch (err) {
console.error(err);
}
if (rtcType === RtcTypes.AgoraWeb && remoteStream) {
return React.createElement(AgoraWebView, { uid: remoteStream === null || remoteStream === void 0 ? void 0 : remoteStream.uid,
// @ts-ignore
videoTrack: (_a = remoteStream === null || remoteStream === void 0 ? void 0 : remoteStream.remoteStream) === null || _a === void 0 ? void 0 : _a.videoTrack,
// @ts-ignore
audioTrack: (_b = remoteStream === null || remoteStream === void 0 ? void 0 : remoteStream.remoteStream) === null || _b === void 0 ? void 0 : _b.audioTrack, isPlayAudio: this.props.isPlayAudio, isPlayVideo: this.props.isPlayVideo, fit: (_c = this.props) === null || _c === void 0 ? void 0 : _c.fit, audioOutputDeviceId: this.props.audioOutputDeviceId });
}
if (rtcType === RtcTypes.TRTCWeb && remoteStream) {
return React.createElement(TRTCWebView, { uid: remoteStream === null || remoteStream === void 0 ? void 0 : remoteStream.uid,
// @ts-ignore
remoteStream: remoteStream === null || remoteStream === void 0 ? void 0 : remoteStream.remoteStream, isPlayAudio: this.props.isPlayAudio, isPlayVideo: this.props.isPlayVideo, fit: (_d = this.props) === null || _d === void 0 ? void 0 : _d.fit, audioOutputDeviceId: this.props.audioOutputDeviceId });
}
return React.createElement("div", null);
}
}
//# sourceMappingURL=index.js.map