1.2.10 • Published 2 years ago

podchat-video-call v1.2.10

Weekly downloads
-
License
ISC
Repository
-
Last release
2 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

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.10

2 years ago

1.2.9

2 years ago

1.1.1

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.66

2 years ago

1.0.69

2 years ago

1.0.68

2 years ago

1.0.67

2 years ago

1.0.73

2 years ago

1.0.72

2 years ago

1.0.71

2 years ago

1.0.70

2 years ago

1.0.77

2 years ago

1.0.76

2 years ago

1.0.75

2 years ago

1.0.74

2 years ago

1.0.79

2 years ago

1.0.78

2 years ago

1.0.80

2 years ago

1.0.83

2 years ago

1.0.82

2 years ago

1.0.81

2 years ago

1.0.62

2 years ago

1.0.61

2 years ago

1.0.60

2 years ago

1.0.65

2 years ago

1.0.64

2 years ago

1.0.63

2 years ago

1.0.51

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.59

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.44

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.41

3 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

3 years ago

1.0.49

2 years ago

1.0.50

2 years ago

1.0.39

3 years ago

1.0.40

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27-tes

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.27-testt

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago