vdotok_stream

A new Flutter plugin.

Getting Started

iOS

Add the following entry to your Info.plist file, located in /ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) Camera Usage!</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) Microphone Usage!</string>

Android

Ensure the following permission is present in your Android Manifest file, located in /android/app/src/main/AndroidManifest.xml:


    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.INTERNET" />


Create Client Instance:

First we need to create an instance of signaling client.


SignalingClient signalingClient = SignalingClient.instance; 

Add listeners:

Below described main helpful callbacks and listeners:


signalingClient.onConnect = (String msg) { 

} 



signalingClient.inError= (int code, String reason) { 

// called in case of getting any error. 

} 
 

signalingClient.onRegister= (Map<String, dynamic> res) { 

// called when user get register successfully 

} 
 


signalingClient.onLocalStream = (stream) { 

// called when local media stream completely prepared 

} 



signalingClient.onRemoteStream = (stream, String refID) { 

// called when remote media stream received from opponent 

} 



signalingClient.onReceiveCallFromUser = (String from, String mediaType) { 

// called when call received from opponent 

} 

signalingClient.onParticipantsLeft = (String refID) { 

// called when a participant left the call.  

} 



signalingClient.onCallRejectedByUser = () { 

// called when received 'reject' signal from opponent 

} 



signalingClient.onCallAcceptedByUser = () { 

// called when received 'accept' signal from opponent 

} 


signalingClient.onCallHungUpByUser = () { 

// called when received 'HungUP' signal from opponent 

} 



signalingClient.onCallBusyCallback = () { 

// called when received 'busy' signal from opponent 

} 



SignalingClient.onAudioVideoStateInfo = (int audioFlag, int videoFlag) { 

// called when audio or video states get changed. 

} 

SDK Methods:

Connection:

Use this method to connect socket.


SignalingClient.connect(String auth_token, String project_id); 

Register:

Use this method to register user

SignalingClient.register(Map<String, dynamic> userData, String project_id); 

Initiate a call:

Use this method to initiate call. Make sure you are providing the following params in this method.


SignalingClient.startCall( 
    String from,  
    String to,  
    String mcToken,  
    String mediaType,  
    String callType,  
    String sessionType); 

Accept a call:

Use this method to accept the call.


SignalingClient.createAnswer(String incommingFrom_refID); 

Reject a call:

Use this method if you want to reject / decline the call.

SignalingClient.declineCall(String refID, String mcToken); 

End a call:

Use this method to stop the call.

SignalingClient.stopCall(String mcToken); 

Switch Camera:

Use this method to switch the camera.

signalingClient.switchCamera(); 

Switch Speaker:

Use this method to switch the speaker.

signalingClient.switchSpeaker(bool flag); 

Enable and Disable Camera:

Use this method to enable and disable the camera.

signalingClient.enableCamera(bool flag); 

Mute and Unmute Mic:

Use this method to mute and unmute the Mic.

signalingClient.muteMic(bool flag); 

Libraries

vdotok_stream