WebGear_RTC API Usage Examples:¶
Requirements¶
Installation with Asyncio Support¶
WebGear_RTC API is the part of asyncio package of VidGear, thereby you need to install VidGear with asyncio support as follows:
Aiortc¶
Must Required with WebGear_RTC API. You can easily install it via pip:
Microsoft Visual C++ 14.0 is required.
Installing aiortc on windows requires Microsoft Build Tools for Visual C++ libraries installed. You can easily fix this error by installing any ONE of these choices:
While the error is calling for VC++ 14.0 - but newer versions of Visual C++ libraries works as well.
- Microsoft Build Tools for Visual Studio.
- Alternative link to Microsoft Build Tools for Visual Studio.
- Offline installer: vs_buildtools.exe
Afterwards, Select: Workloads → Desktop development with C++, then for Individual Components, select only:
- Windows 10 SDK
- C++ x64/x86 build tools
Finally, proceed installing aiortc via pip.
ASGI Server¶
You'll also need to install an ASGI Server to run following WebGear_RTC usage examples, and by default WebGear_RTC ships the state-of-the-art uvicorn Server. But you can also use other ASGI server such as daphne, or hypercorn with it.
Â
Bare-Minimum Usage¶
Let's implement a Bare-Minimum usage example:
Running Programmatically ¶
You can access and run WebGear_RTC VideoStreamer Server programmatically in your python script in just a few lines of code, as follows:
For accessing WebGear_RTC on different Client Devices on the network, use "0.0.0.0" as host value instead of "localhost" on Host Machine. More information can be found here âž¶
We are using frame_size_reduction attribute for frame size reduction (in percentage) to be streamed with its options dictionary parameter to cope with performance-throttling in this example.
which can be accessed on any browser on your machine at http://localhost:8000/.
Â