issue with switch camera flashphoner in react

Max

Administrator
Staff member
Good day.
We do not see any problems. The stream is publishing from a camera chosen (Chrome 120 browser):
1702947677458.png

What exactly does not work for you?
 

Max

Administrator
Staff member
You have not added a constraint neede to capture from the device chosen:
1702967753658.png

You should get the device id from the videoInput item and set it to the proper video constraint:
Code:
      session.createStream({
        name: streamName,
        display: localVideo,
        cacheLocalResources: true,
        receiveVideo: false,
        receiveAudio: false,
        videoContentHint: "motion".
        constraints: {
            video: {
                deviceId: document.getElementById("videoInput").value
            }
        }
        ...
      });
 

Max

Administrator
Staff member
The Media Devices example is too complex to convert it to one component. It should be used only as a bundle of code samples to implement them.
Please see also this article where Media Devices functions are split to a code samples, one per function.
 

antu123

Member
Hello Max ,
I want to know how can I record a stream in React Functional component and then upload it to a remote server.
Thanks for your help
 

antu123

Member
Hello Max ,
I have been trying to create two component one for local or one for remote. When I added remote code in other component play button functionality stopped working. I'm requesting you to please add a remote code in separate component with react function-based for this, please.
also react-router not working in below src folder

When I input width height In 4K (Ultra HD): 3840 x 2160 pixels getting lagging issue.
can we set auto connected server (by default connected).
where store recorded video on server and how to setup.

Please find below attachment a source code sample to test using .
 

Attachments

Last edited:

Max

Administrator
Staff member
Please refer to the source code sample on GitHub:
Code:
    if(session && remoteVideo) {
      session.createStream({
        name: streamName,
        display: remoteVideo
      }).on(STREAM_STATUS.PENDING, (stream) => {
        ...
      }).play();
    }
Usually, no additional parameters needed to play video. And you should not add publish constraints to playback options like you did:
1703121454447.png

Please read the doc about publishing and the doc about playing.
When I input width height In 4K (Ultra HD): 3840 x 2160 pixels getting lagging issue.
The channel bandwidth may be not enough to publish 4K video. Please test with lower resolutions.
can we set auto connected server (by default connected).
Please look at this example: Streaming Auto Restore
where store recorded video on server and how to setup.
Please refer to this doc about recording setup: Stream recording
 

Max

Administrator
Staff member
On your screenshot, this keyword is highlighted
1703466637962.png

Seems like this is undefined here. Please use a correct object here.
 

Max

Administrator
Staff member
we are getting error on unpublished button streaming.

TypeError: stream.getRecordInfo is not a function
Please check the stream object in the scope. May be you override it by some other type.
You can always test Stream Recording example (GitHub) in browser, it uses this method.
 
Top