vdotok_stream 0.0.20 vdotok_stream: ^0.0.20 copied to clipboard
By using this package you can connect with vdotok and use vdotok services. you can make one 2 one, many 2 many, Group calls , broadcast etc.
vdotok_stream #
A new Flutter plugin.
Getting Started #
iOS #
Add the following entry to your Info.plist file, located in
<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
<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.
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
};
VDOTOK_STREAM SDK Methods: #
Connection: #
Use this method to connect socket.
signalingClient.connect(String deviceId, String projectId, String completeAddress, String authorization_token, String ref_id);
Initiate Call: #
Use this method to initiate call. Make sure you are providing the following params in this method.
One-to-One #
signalingClient.startCallOneToOne(
String from,
Map < String, dynamic > customData,
List < String > to,
String mediaType,
String mcToken,
String callType,
String sessionType);
Many-to-Many #
signalingClient.startCall(
Map < String, dynamic > customData,
String from,
List < String > to,
String mcToken,
String mediaType,
String callType,
String sessionType);
One-to-Many #
signalingClient.startCallOneToMany(
String from,
Map < String, dynamic > customData,
List < String > to,
String mediaType,
String mcToken,
String callType,
String sessionType,
bool isPublicBroadcast,
String broadcastType,
String authorizationToken);
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();