How to show webcam preview by default

Hi,
Is there any way to by default show webcam preview on demo page and when we click on start button then streaming start.
Your all demos not show webcam preview by default instead when you click on start button then webcam preview shows and streaming start.
For example we want when we click on WebRTC as RTMP re-publishing demo default webcam preview should be shown automatically and when we click on start button then it should start streaming to RTMP target details.
Is it possible?

Thanks,
Faraz
 

Max

Administrator
Staff member
Hello,

Call getMediaAccess() after API initiation , e.g.
Flashphoner.getMediaAccess(null, localVideo);
The 1st parameter is for video constraints (default will be used if 'null'), and the 2nd is the element, in which video from camera will be displayed.
This can be checked with WebRTC as RTMP example if replace the original script with the attached (in WCS_HOME/client2/examples/demo/streaming/webrtc-as-rtmp-republishing directory).
 

Attachments

Hi @Max Thanks for your reply.
We also want to give option to select audio video device and video size before click on start button.
So as user select another video device or another video size then how we stop previous showing video cam and show new selected cam with new size?

Thanks,
Faraz
 

Max

Administrator
Staff member
stop previous showing video cam and show new
Call releaseLocalMedia(): https://github.com/flashphoner/flashphoner_client/blob/wcs_api-2.0/src/flashphoner-core.js#L293
Then again call getMediaAccess() passing the new constraints.

Please see Media Devices example: there are different buttons for preview (Test) and publishing (Start)
- git: https://github.com/flashphoner/flas...mo/streaming/media_devices_manager/manager.js
- demo: https://wcs5-eu.flashphoner.com/demo2/media-devices
 
Top