npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

podchat-video-call

v1.2.10

Published

component for make or receive call in podchat

Downloads

103

Readme

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(){
  
}