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

@integraciones_doc24/meeting-react-native

v0.32.0

Published

React Native library for meeting with Doc24 professionals on Android and iOS

Downloads

112

Readme

@integraciones_doc24/meeting-react-native

React Native library for meeting with Doc24 professionals on Android and iOS

Installation

npm i @integraciones_doc24/meeting-react-native

Then, follow the installation intructions of the opentok-react-native library, skipping the installation of the opentok-react-native npm module.

Usage

This library exposes a component Doc24MeetingCall and a hook useDoc24NativeMeeting

useDoc24NativeMeeting takes one parameter of type BaseDoc24MeetingProps and returns an object of type MeetingStatus

  type BaseDoc24MeetingProps = {
    // The vcToken you should have gotten through the sdk
    vcToken: string;
    // The url of the public api of doc24
    serverUrl: string;

    // Callbacks
    onEndCall?: () => void;
    onAnsweredCall?: (parameters: TokBoxParameters) => void;
    onHoldCall?: () => void;
    onResumeCall?: (parameters: TokBoxParameters) => void;
    onError?: (error: unknown) => void;
  }

  type MeetingStatus =
    | {type: 'ended'}
    | {type: 'canceled'}
    | {type: 'waiting'}
    | {type: 'onHold'}
    | {type: 'error'}
    | {
        type: 'active';
        helpers: MeetingHelpers;
        session: OTSession;
        parameters?: TokBoxParameters
      };

  type MeetingHelpers = {
    endCall: () => Promise<void>;
  }

When the professional answers the call, useDoc24NativeMeeting returns an object with the property type === 'active' and two other properties. One of those properties, session, should be passed as props to Doc24MeetingCall. The other one, helpers has one method that can be used to end the call.

Example

export const CallComponent = (props: CallComponentProps) => {
  const status = useDoc24NativeMeeting({
     serverUrl: "https://tapiaws.doc24.com.ar/ws",
     vcToken: props.vcToken,
     onEndCall: () => {
       // Go to post-call page
       props.onEndCall()
     },
   });
 
   if (status.type === "waiting")
     return <Text>Waiting for the professional to answer the call</Text>;
 
   if (status.type === "onHold")
     return <Text>The professional has put you on hold</Text>;

  if (status.type === "canceled")
    return <Text>The professional canceled your meeting</Text>;
 
   if (status.type === "ended" || status.type === 'error') return null;
 
 
   const buttons = (
     <View
       style={{
         width: '100%',
         height: '100%',
         padding: 16,
         justifyContent: 'flex-end',
       }}>
       <View style={{width: '100%', height: 50, justifyContent: 'space-around'}}>
         <Button
          title="End call"
          onPress={() => status.helpers.endCall()}
        />
       </View>
     </View>
   );
 
   return (
     <Doc24MeetingCall
       session={status.session}
       overlay={buttons}
     />
   );
 };

Doc24MeetingCall props

    // The session, you should get this from `useDoc24NativeMeeting`
    session: OTSession
    
    // A component that takes the full space of the component on top of it, usefull for showing buttons or information
    overlay: JSX.Element;
    // Component to show while loading
    loading?: JSX.Element
    // Which camera to use
    cameraPosition?: 'front' | 'back';
    // Disable publishers mic
    disableMic?: boolean;
    // Disable publishers camera
    disableCamera?: boolean;
    // Stylize the publisher (patient) video component. It will clear default style, so you'll need to set zIndex, position, etc. 
    publisherStyle?: StyleProp<ViewStyle>;
     // Stylize the subscriber (doctor) video component. It will clear default style, so you'll need to set zIndex, position, etc. 
    subscriberStyle?: StyleProp<ViewStyle>;