1.2.10 • Published 3 years ago

podchat-video-call v1.2.10

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Javascript component for podchat video call

With pod chat-video-call you can use video/voice call from Pod platform, without any headache for configurations.

Installation:

npm install podchat-video-call

Import reference:

import VideoCall from 'podchat-video-call';

How to use:

import * as PodChat from 'podchat-browser';

function main(){

    var params = {
    
     ... // as usual
     
      callOptions: {
        callSocketAddress: "wss://46.32.6.187",
        callTurnIp: "46.32.6.188",
        callDivId: "call-div",
        callAudioTagClassName: "podcall-audio",
        callVideoTagClassName: "podcall-video"
      },
      ....
    };

    this.chatAgent = new PodChat(params);
  	let videoCall= initVideoComponent();
    this.chatAgent.on("chatReady", () => {
    	videoCall.setChatAgent(this.chatAgent);
   		videoCall.call(
        {
          threadId: "thread id" // the thread id that use for call ,
           invitees: [
             		 {
               			 "id": 'username',
               			 "idType": "TO_BE_USER_USERNAME"
             		 }],
         type: "VIDEO"
       });

    });
      
  });
   
}

 function initVideoComponent(){
    let videoCall = new VideoCall(
   'call-container', // HTML element ID that you want to load video  component on it.
    {
      endCallback: endCall ,// this event will raise when video call is ended
      cancelCallback: cancelCall //// this event will raise when  video call is canceled,
      userInfo: this.chatAgent.getCurrentUser(),
      waitingText: `<div style="text-align:center"> 
                      <h4 style="font-size:16px;color: rgba(255, 255, 255, 0.8);
                          font-weight: normal; font-stretch: normal;font-style: normal;
                          line-height: normal">نوع خدمت:${bankingServiceTitle}
                      </h4>
                      <span style="font-size:16px;color: rgba(255, 255, 255, 0.8);
                        font-weight: normal; font-stretch: normal;font-style: normal;line-height: normal">
                          درحال برقراری تماس...
                      </span>
                    </div>
                    `,
        receiveCallTimeout: ,//  timeout for chat SDK receive call event (millisecond)
        callStartedTimeout: ,// timeout for chat SDK call started  event (millisecond) 
        timeoutCallback: ,
        receiveCallback: ,// this will call when SDK receive call will raise
    });

   videoCall.render();
   return videoCall;
 }


function endCall(){

} 

Full example

Below code show full example of podchat video call that set all required parameters and functions

import * as PodChat from 'podchat-browser';

function main(){

    var params = {
      appId: "appId",
      /**
       * Sand Box
       */
      socketAddress: "wss://chat-sandbox.pod.ir/ws",
      ssoHost: "https://accounts.pod.ir",
      platformHost: "https://sandbox.pod.ir:8043/srv/basic-platform",
      fileServer: 'https://core.pod.ir',
      podSpaceFileServer: 'https://podspace.pod.ir',
      serverName: "chat-server",

      token: 'token',// pod token
      grantDeviceIdFromSSO: false,
      enableCache: false,
      fullResponseObject: true,
      typeCode: "default",
      wsConnectionWaitTime: 500,
      connectionRetryInterval: 5000,
      connectionCheckTimeout: 10000,
      messageTtl: 24 * 60 * 60,
      reconnectOnClose: true,
      httpRequestTimeout: 30000,
      httpUploadRequestTimeout: 0,
      forceWaitQueueInMemory: true,
      asyncRequestTimeout: 20000,
      callOptions: {
        callSocketAddress: "wss://46.32.6.187",
        callTurnIp: "46.32.6.188",
        callDivId: "call-div",
        callAudioTagClassName: "podcall-audio",
        callVideoTagClassName: "podcall-video"
      },
      asyncLogging: {
        onFunction: true,
        consoleLogging: true,
        onMessageReceive: false,
        onMessageSend: false,
        actualTiming: false
      }
    };

    this.chatAgent = new PodChat(params);
  	let videoCall= initVideoComponent();
    this.chatAgent.on("chatReady", () => {
    	videoCall.setChatAgent(this.chatAgent);
   		 var Params = {
     		 invitees: [
        	{
        	  "id": 'username',
       		  "idType": "TO_BE_USER_USERNAME"
       	 }],
   		 };

	    this.chatAgent.createThread(Params, (createThreadResult) => {
      	
     		if (!createThreadResult.hasError) {
        	
      	 	 this.threadId = createThreadResult.result.thread.id;       		 
      		 		videoCall.call(
       		 	 	 {
          		 	 threadId: this.threadId,
           			 invitees: [
             		 {
               		 "id": 'username',
               		 "idType": "TO_BE_USER_USERNAME"
             		 }],
            		type: "VIDEO"
         		 });
     		 } else {
       			 console.log('thread creation failed!!!')
    	  	}
          
     	 	if (createThreadResult.errorCode == 21) {
     	 	 console.log('unauthenticated user!!!')
      		}

    });
      
  });

  this.chatAgent.on("error", (err) => {
     console.error(err);

    }); 
   
}

 function initVideoComponent(){
     let videoCall = new VideoCall(
  	 'call-container', // HTML element ID that you want to load video  component on it.
      {
     	 endCallback: endCall ,// this event will raise when video call is ended
     	 cancelCallback: cancelCall //// this event will raise when  video call is canceled,
     	 userInfo: this.chatAgent.getCurrentUser(),
     	 waitingText: `<div style="text-align:center"> 
                      <h4 style="font-size:16px;color: rgba(255, 255, 255, 0.8);
                          font-weight: normal; font-stretch: normal;font-style: normal;
                          line-height: normal">نوع خدمت:${bankingServiceTitle}
                      </h4>
                      <span style="font-size:16px;color: rgba(255, 255, 255, 0.8);
                        font-weight: normal; font-stretch: normal;font-style: normal;line-height: normal">
                          درحال برقراری تماس...
                      </span>
                    </div>
                    `,
        receiveCallTimeout: ,//  timeout for chat SDK receive call event (millisecond)
        callStartedTimeout: ,// timeout for chat SDK call started  event (millisecond) 
        timeoutCallback: ,
        receiveCallback: ,// this will call when SDK receive call will raise
    });
   videoCall.render();
   return videoCall;
 }


function endCall(){

} 

fuction cancelCall(){
  
}
1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.10

3 years ago

1.2.9

3 years ago

1.1.1

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.66

3 years ago

1.0.69

3 years ago

1.0.68

3 years ago

1.0.67

3 years ago

1.0.73

3 years ago

1.0.72

3 years ago

1.0.71

3 years ago

1.0.70

3 years ago

1.0.77

3 years ago

1.0.76

3 years ago

1.0.75

3 years ago

1.0.74

3 years ago

1.0.79

3 years ago

1.0.78

3 years ago

1.0.80

3 years ago

1.0.83

3 years ago

1.0.82

3 years ago

1.0.81

3 years ago

1.0.62

3 years ago

1.0.61

3 years ago

1.0.60

3 years ago

1.0.65

3 years ago

1.0.64

3 years ago

1.0.63

3 years ago

1.0.51

4 years ago

1.0.55

4 years ago

1.0.54

4 years ago

1.0.53

4 years ago

1.0.52

4 years ago

1.0.59

4 years ago

1.0.58

4 years ago

1.0.57

4 years ago

1.0.56

4 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.41

4 years ago

1.0.47

4 years ago

1.0.46

4 years ago

1.0.45

4 years ago

1.0.49

4 years ago

1.0.50

4 years ago

1.0.39

4 years ago

1.0.40

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27-tes

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.27-testt

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago