vdotok_stream

A new Flutter plugin.

Getting Started

iOS

Add the following entry to your Info.plist file, located in < project root >/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 < project root >/android/app/src/main/AndroidManifest.xml:


    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />


And specify the service inside the


<service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:foregroundServiceType="mediaProjection" android:enabled="true" android:exported="false"/>


Add JniLibs folder into android>app>src>main, of the project. Don’t forget to unzip jniLibs.zip file before adding.

Download

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 response) 
{

// called when socket is connected successfully

};

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

// called when user get register successfully

};

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

// called in case of getting any error

};

signalingClient.onLocalStream = (MediaStream stream) 
{

// called when local media stream is completely prepared

};

signalingClient.onRemoteStream = (MediaStream stream, String refId) 
{

// called when remote media stream is received from opponent

};

signalingClient.onReceiveCallFromUser = (Map<String, dynamic> incoming , bool isMultiSession) 
{

// called when call is received from opponent

};

signalingClient.onParticipantsLeft = (String refId, bool isReceive, bool isMultiSession) 
{

// called when a participant leave the call

};

signalingClient.onCallAcceptedByUser = () 
{

// called when participant accepts the call

};

signalingClient.onCallHungUpByUser = (bool isLocal) 
{

// called when call is hung up from any side

};

signalingClient.onCallBusyCallback = () 
{

// called when caller receives busy signal from opponent

};

signalingClient.onAudioVideoStateInfo = (int audioFlag, int videoFlag, String refId) 
{

// called when audio or video states get changed

};

signalingClient.onTargetAlerting = () 
{

// called when the caller receives that callee gets alert

};

signalingClient.onAddparticpant = (int paticipantCount, String calltype) {

// called when new participant added

};

signalingClient.unRegisterSuccessfullyCallBack = () 
{

// called when user successfully unregisters

};


signalingClient.onReceiveUrlCallback = (String url) 
{

// called in case of publich broadcasting when user receives public url

};

signalingClient.internetConnectivityCallBack = (String mesg) 
{

// called when user connected or disconnected

};

signalingClient.onMissedCall = (String mesg) 
{

// called when call is missed

};

signalingClient.onCallDial = () 
{
     
// called when call is dialed

};

signalingClient.onHvInfo = ()
{

// called when user gets hv info

};

Models:

Below are the Models:

// Use this Model for login/sign up

class User {

  final String auth_token;
  final String authorization_token;
  final String email;
  final String full_name;
  final String message;
  final int process_time;
  final String ref_id;
  final int status;
  final int user_id;

}

// Use this Model for Groups

class GroupModel {

  dynamic admin_id;
  dynamic auto_created;
  dynamic channel_key;
  dynamic channel_name;
  dynamic group_title;
  dynamic id;
  dynamic created_datetime;

}

// Use this Model for Getting All Users

class Contact {

  int user_id;
  dynamic email;
  String ref_id;
  String full_name;

}

Constants:

Class used for Media Type:


class MediaType {
  static String video = "video";
  static String audio = "audio";
}

Class used for Call Type:


class CallType {
  static String one2one = "one_to_one";
  static String one2many = "one_to_many";
  static String many2many = "many_to_many";
 
}

Class used for Session Type:


class SessionType {
  static String call = "call";
  static String screen = "screen";
}

VDOTOK_STREAM SDK Methods:

Connection:

Use this method to connect socket.


signalingClient.connect(
    String deviceId, // any random String 
    String projectId, 
    String completeAddress, // in Login/SignUp response
    String authorization_token, // in Login/SignUp response
    String ref_id // in Login/SignUp response
    );

Initiate Call:

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

One-to-One

signalingClient.startCallOneToOne( 
            String from, // your own refId which you will get from Login/Signup response
            Map < String, dynamic > customData, // Any kind of custom data which you want to use on incoming side
            List < String > to, // list of participant's refIds
            String mediaType, // "audio" or "video"
            String mcToken, // mcToken will receive upon register response/onRegister callback
            String callType, // "one_to_one"
            String sessionType // "call"
            ); 

Many-to-Many

signalingClient.startCall( 
            Map < String, dynamic > customData, // Any kind of custom data which you want to use on incoming side
            String from,  // your own refId which you will get from Login/Signup response
            List < String > to, // list of participant's refIds
            String mcToken, // mcToken will receive upon register response/onRegister callback
            String mediaType, // "audio" or "video"
            String callType, // "many_to_many"
            String sessionType // "call"       
            ); 
        

One-to-Many

signalingClient.startCallOneToMany( 
            String from,  // your own refId which you will get from Login/Signup response
            Map < String, dynamic > customData, // Any kind of custom data which you want to use on incoming side
            List < String > to, // list of participant's refIds
            String mediaType, "audio" or "video"
            String mcToken, // mcToken will receive upon register response/onRegister callback
            String callType, // "one_to_many"
            String sessionType, // "call" or "screen"
            bool isPublicBroadcast, // true or false
            String broadcastType, // "appaudio" or "camera" or "micaudio" or "appaudioandcamera" or "micaudioandcamera"
            String authorizationToken // your own authorizationToken which you will get from Login/SignUp response
            );
    

Accept Call:

Use this method to accept the call.


signalingClient.createAnswer(String incomingRefId);

Reject Call:

Use this method if receiver wants to reject / decline the call.


signalingClient.declineCall(String refId, String mcToken);

End Call:

Use this method to stop the call.


signalingClient.stopCall(String mcToken);

Enable/Disable Screen Share:

Use this method to enable/disable screen share.


signalingClient.enableScreen(bool flag)

Switch Camera:

Use this method to switch the camera (between front and rear).


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);

Mute and Unmute Internal Mic:

Use this method to mute and unmute Internal Mic.


signalingClient.muteInternalMic();

unRegister:

Use this method to unregister once the user logs out.


signalingClient.unRegister(String mcToken);

Send Ping

Use this method to check if socket is connected or not. If it’s not connected then the User won’t get “Pong” from server.


signalingClient.sendPing(String mcToken);

Close Socket

Use this method to close the socket manually.

signalingClient.closeSocket(); 

Audio Video State

Use this method to send audio (mute/unmute) and video (enable/disable camera) state.


signalingClient.audioVideoState(int audioFlag, int videoFlag, String mcToken); 

Listener for Internet Connection/Disconnection

Use this method to listen changes every time the User’s device is connected to internet or disconnected from internet.


signalingClient.checkConnectivity();

Internet Status

Use this method to check whether or not the User’s device is connected to internet. It will return true or false value.


signalingClient.getInternetStatus(); 

Libraries

core/dart_webrtc
core/helper
core/interface/enums
core/interface/factory
core/interface/media_recorder
core/interface/media_stream
core/interface/media_stream_track
core/interface/mediadevices
core/interface/rtc_configuration
core/interface/rtc_data_channel
core/interface/rtc_dtmf_sender
core/interface/rtc_ice_candidate
core/interface/rtc_peerconnection
core/interface/rtc_rtcp_parameters
core/interface/rtc_rtp_parameters
core/interface/rtc_rtp_receiver
core/interface/rtc_rtp_sender
core/interface/rtc_rtp_transceiver
core/interface/rtc_session_description
core/interface/rtc_stats_report
core/interface/rtc_track_event
core/interface/rtc_video_renderer
core/interface/webrtc_interface
core/media_devices
core/media_recorder
core/native/BroadCast
core/native/factory_impl
core/native/media_recorder_impl
core/native/media_stream_impl
core/native/media_stream_track_impl
core/native/mediadevices_impl
core/native/rtc_data_channel_impl
core/native/rtc_dtmf_sender_impl
core/native/rtc_peerconnection_impl
core/native/rtc_rtp_receiver_impl
core/native/rtc_rtp_sender_impl
core/native/rtc_rtp_transceiver_impl
core/native/rtc_track_event_impl
core/native/rtc_video_renderer_impl
core/native/rtc_video_view_impl
core/native/utils
core/signalingClient/config
core/signalingClient/InternetManager/InternetManager
core/signalingClient/InternetManager/InternetManagerForIO
core/signalingClient/InternetManager/InternetManagerForWeb
core/signalingClient/InternetManager/InternetManagerStub
core/signalingClient/signalingClient
core/signalingClient/socketManager/socketManager
core/signalingClient/socketManager/socketManagerForIO
core/signalingClient/socketManager/socketManagerForWeb
core/signalingClient/socketManager/socketManagerStub
core/signalingClient/web_socket_connection
core/src/factory_impl
core/src/media_devices
core/src/media_recorder
core/src/media_recorder_impl
core/src/media_stream_impl
core/src/media_stream_track_impl
core/src/mediadevices_impl
core/src/rtc_data_channel_impl
core/src/rtc_dtmf_sender_impl
core/src/rtc_peerconnection_impl
core/src/rtc_rtp_parameters_impl
core/src/rtc_rtp_receiver_impl
core/src/rtc_rtp_sender_impl
core/src/rtc_rtp_transceiver_impl
core/src/rtc_track_event_impl
core/src/rtc_video_element
core/web/factory_impl
core/web/rtc_video_renderer_impl
core/web/rtc_video_view_impl
core/web/utils
core2/src/CallingModule/Many2ManyCall/Many2ManyCall
core2/src/CallingModule/One2OneCall/One2OneCall
core2/src/InternetManager/InternetManager
core2/src/InternetManager/InternetManagerForIO
core2/src/InternetManager/InternetManagerForWeb
core2/src/InternetManager/InternetManagerStub
core2/src/SignalingClient/SignalingClient
core2/src/SocketManager/SocketManager
core2/src/SocketManager/SocketManagerForIO
core2/src/SocketManager/SocketManagerForWeb
core2/src/SocketManager/SocketManagerStub
core2/src/SocketManager/socketManagerStub
core2/src/SocketManager/WebSocketConnection
flutter_webrtc
vdotok_stream
vdotok_stream_web