Code Monkey home page Code Monkey logo

Comments (7)

EkaanshArora avatar EkaanshArora commented on May 20, 2024

can you share a code snippet?

from videouikit-reactnative.

teefortayyab avatar teefortayyab commented on May 20, 2024

@EkaanshArora I have been facing issues customizing design view with the default import of the package, So, I used separate components to customize the design accordingly to requirements. Everything is working fine except some callbacks.

Working callbacks are EndCall, UserJoined, UserOffline. But UserMuteVideo,RemoteVideoStateChanged and UserEnableVideo are not triggered when the remote user is pausing/resuming the video.

You can see the code snippet in other comment.

from videouikit-reactnative.

teefortayyab avatar teefortayyab commented on May 20, 2024

@EkaanshArora

const props = {
    rtcProps: {
      appId: config.appId,
      layout: 1, //pinned layout
      channel: roomId ? roomId.toString() : null,
    },
    callbacks: {
      EndCall: () => handleEndCall(),
      Warning: (warning) => console.log('WARNING:::', warning),
      Error: (error) => console.log('ERROR:::', error),
      ConnectionStateChanged: (e) => console.log('CONNECTION STATE CHANGED:::', e),
      JoinChannelSuccess: (e) => console.log('JOIN CHANNEL SUCCESS:::', e),
      RtcStats: (e) => console.log('RTC STATS:::', e),
      ConnectionBanned: () => console.log('CONNECTION BANNED'),
      ConnectionInterrupted: () => console.log('CONNECTION INTERRUPTED'),
      RequestToken: () => console.log('REQUEST TOKEN'),
      TokenPrivilegeWillExpire: () => console.log('TOKEN PRIVILEGE WILL EXPIRE'),
      ConnectionLost: () => console.log('CONNECTION LOST'),
      ApiCallExecuted: () => console.log('API CALL EXECUTED'),
      UserJoined: () => handleStartCall(),
      UserOffline: () => callEnded(),
      UserMuteVideo: (uid, muted) => console.log({ uid, muted }),
      RemoteVideoStateChanged: (uid, state, reason, elapsed) => console.log({ uid, state, reason, elapsed }),
      UserEnableVideo: (uid, enabled) => console.log({ uid, enabled }),
    },
  };
  
  <PropsProvider value={props}>
      <View style={{ flex: 1 }}>
        {showEndCallAnimation && (
          <Image
            source={require('@assets/img/VideoToNoVideoTransition.gif')}
            style={styles.animatedAbsoluteContainerView}
          />
        )}
        <PermissionModal
          showPermissionsModal={showPermissionsModal}
          setShowPermissionsModal={setShowPermissionsModal}
        />
        <CallStatus callConnected={callConnected.current} />
        <View style={{ flex: 1 }}>
          <RtcConfigure>
            <QuestionnaireModal questions={questions} />
            {showQuestionPopup && <QuestionPopUp questions={questions} />}
            <MaxUidConsumer>
              {(maxUsers) => (maxUsers[0] ? <MaxVideoView user={maxUsers[0]} key={maxUsers[0].uid} /> : null)}
            </MaxUidConsumer>
            <View style={styles.videoContainer}>
              <MinUidConsumer>
                {(minUsers) =>
                  minUsers.map((user) =>
                    user.video ? (
                      <>
                        <MinVideoView user={user} key={user.uid} />
                        <LocalUserContextComponent>
                          <SwitchCamera />
                        </LocalUserContextComponent>
                      </>
                    ) : (
                      <View
                        style={{
                          width: 120,
                          height: 200,
                          justifyContent: 'center',
                          alignItems: 'center',
                          backgroundColor: '#161C24',
                        }}>
                        <Image
                          source={{
                            uri: authUser?.profile?.photos?.length
                              ? authUser?.profile?.photos[0]
                              : DEFAULT_PROFILE_IMAGE,
                          }}
                          resizeMode='cover'
                          style={{ height: 75, width: 75, borderRadius: 100 }}
                        />
                        <LocalUserContextComponent>
                          <SwitchCamera />
                        </LocalUserContextComponent>
                      </View>
                    )
                  )
                }
              </MinUidConsumer>
            </View>
            <LocalControls />
          </RtcConfigure>
        </View>
        <View style={styles.parent}>
          <View style={styles.innerChild1}>
            <Image
              source={{ uri: receiverImage }}
              resizeMode='cover'
              style={{ height: 30, width: 30, borderRadius: 15 }}
            />
            <Text style={styles.innerChild1Text}>{receiverName && age ? `${receiverName}, ${age}` : ''}</Text>
          </View>
          {callConnected.current && roomData && mixerId ? (
            <View style={styles.innerChild2}>
              <ProgressBar stopCallAutomatically={handleEndCall} roomData={roomData} />
            </View>
          ) : (
            <ActivityIndicator color={'#281E48'} size={30} />
          )}
        </View>
      </View>
    </PropsProvider>

from videouikit-reactnative.

EkaanshArora avatar EkaanshArora commented on May 20, 2024

This looks like a bug, Iā€™m out of office so I can try and fix this next week. In the meantime you can access the engine from the RtcContext and attach the event listener manually.

from videouikit-reactnative.

teefortayyab avatar teefortayyab commented on May 20, 2024

@EkaanshArora Can you share any example for How can I attach a listener manually from RtcContext?

from videouikit-reactnative.

teefortayyab avatar teefortayyab commented on May 20, 2024

@EkaanshArora Can you share any update or steps so that I can use RTC event in my application?

from videouikit-reactnative.

EkaanshArora avatar EkaanshArora commented on May 20, 2024

You can look at this file for an example of how to access the rtcEngine.
Here's a snippet to listen for an event:

function AddEvent() {
  const {RtcEngine} = useContext(RtcContext);
  useEffect(()=>{
    RtcEngine.addListener('RemoteVideoStateChanged', (uid, state, reason, elapsed) => {
      // do things
    })
  },[])
  return null
}

// render it in your tree
...
    <AddEvent />
  </MinUidConsumer>
</View>

I'll try and fix this in the coming week, so you can just use the callbacks object.

from videouikit-reactnative.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.