Skip to content

Commit

Permalink
fix. error
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrixbirds committed Jan 29, 2019
1 parent 8c01875 commit c22886a
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 903 deletions.
1 change: 0 additions & 1 deletion AgoraView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
IAgoraViewProps
} from "./types.d";


export default class AgoraView extends React.Component<IAgoraViewProps> {
render() {
return (
Expand Down
138 changes: 125 additions & 13 deletions RtcEngine.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
import {
NativeModules,
NativeAppEventEmitter
NativeAppEventEmitter,
EmitterSubscription
} from 'react-native';

import {
IRtcEngineOption, IRTCEngineEventScheduler,
String, Integer
IOption, IVideoOption,
IEventScheduler, IPublisherConfig,
ILiveTranscoding, ICallback,
String, Number
} from "./types.d";

const { Agora } = NativeModules;

export default class RtcEngine extends Agora {
static init(options: IRtcEngineOption): void {
export default class RtcEngine {

private static listener: EmitterSubscription = null;
static init(options: IOption): void {
this.removeEmitter();
super.init(options);
Agora.init(options);
}

static joinChannel(channelName: String, uid?: Integer): void {
super.joinChannel(channelName, uid);
static joinChannel(channelName: String, uid?: Number): void {
Agora.joinChannel(channelName, uid);
}

static joinChannelWithToken(
channelName: string, token?: String, uid?: Integer): void {
super.joinChannelWithToken(token, channelName, uid);
channelName: string, token?: String, uid?: Number): void {
Agora.joinChannelWithToken(token, channelName, uid);
}

static eventEmitter(eventScheduler: IRTCEngineEventScheduler) {
static eventEmitter(eventScheduler: IEventScheduler) {
this.listener && this.listener.remove();
this.listener = NativeAppEventEmitter.addListener('agoraEvent', event => {
const functor = (eventScheduler as any)[event['type']];
Expand All @@ -38,11 +43,118 @@ export default class RtcEngine extends Agora {
}

static enableLastmileTest() {
super.enableLastmileTest();
Agora.enableLastmileTest();
}

static disableLastmileTest() {
super.disableLastmileTest();
Agora.disableLastmileTest();
}

static leaveChannel() {
Agora.leaveChannel();
}

static destroy() {
Agora.destroy();
}

static setupLocalVideo(options: IVideoOption) {
Agora.setupLocalVideo(options);
}

static setupRemoteVideo(options: IVideoOption) {
Agora.setupRemoteVideo(options);
}

static startPreview() {
Agora.startPreview();
}

static stopPreview() {
Agora.stopPreview();
}

static configPublisher(options: IPublisherConfig) {
Agora.configPublisher(options);
}

static setLiveTranscoding(options: ILiveTranscoding) {
Agora.setLiveTranscoding(options);
}

static setLocalRenderMode(mode: number) {
Agora.setLocalRenderMode(mode);
}

static setRemoteRenderMode(mode: number) {
Agora.setRemoteRenderMode(mode);
}

static enableAudioVolumeIndication(interval: number, smooth: number) {
Agora.enableAudioVolumeIndication(interval, smooth);
}

static switchCamera() {
Agora.switchCamera();
}

static enableVideo() {
Agora.enableVideo();
}

static disableVideo() {
Agora.disableVideo();
}

static setEnableSpeakerphone(status: boolean) {
Agora.setEnableSpeakerphone(status);
}

static muteLocalAudioStream(status: boolean) {
Agora.muteLocalAudioStream(status);
}

static muteRemoteAudioStream(uid: number, status: boolean) {
Agora.muteRemoteAudioStream(uid, status);
}

static setCameraTorchOn(status: boolean) {
Agora.setCameraTorchOn(status);
}

static setCameraAutoFocusFaceModeEnabled(status: boolean) {
Agora.setCameraAutoFocusFaceModeEnabled(status);
}

static setDefaultAudioRouteToSpeakerphone(status: boolean) {
Agora.setDefaultAudioRouteToSpeakerphone(status);
}

static muteLocalVideoStream(status: boolean) {
Agora.muteLocalVideoStream(status);
}

static enableLocalVideo(status: boolean) {
Agora.enableLocalVideo(status);
}

static muteAllRemoteVideoStreams(status: boolean) {
Agora.muteAllRemoteVideoStreams(status);
}

static muteRemoteVideoStream(status: boolean) {
Agora.muteAllRemoteVideoStreams(status);
}

static createDataStream(reliable: boolean, ordered: boolean, callback: ICallback<void>) {
Agora.createDataStream(reliable, ordered, callback);
}

static sendStreamMessage(streamId: number, data: any, callback: ICallback<void>) {
Agora.sendStreamMessage(streamId, data, callback);
}

static getSdkVersion(callback: ICallback<void>) {
Agora.getSdkVersion(callback);
}
};
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export { default as AgoraView } from './AgoraView';
export { default as RtcEngine } from './RtcEngine';
import _AgoraView from './AgoraView';
import _RtcEngine from './RtcEngine';

export const AgoraView = _AgoraView;
export const RtcEngine = _RtcEngine;
Loading

0 comments on commit c22886a

Please sign in to comment.