Cloudinary is a cloud service that offers a solution to a web application's entire image and video management pipeline. Easily upload images and videos to the cloud. Automatically perform smart resizing, cropping and conversion without installing any complex software. Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.
Cloudinary provides an end-to-end live video streaming solution, with on the fly video effects and transformations. When using the library in your website this is what happens:
- Video is streamed from the device's camera.
- The video is up-streamed through Cloudinary, providing the streaming user with a Cloudinary public id and resource url of the stream.
- The stream is now publicly available through that url, and can be fed into any streaming-supported video player.
- If any transformations and effects were added to the stream (during configuration, see below) all the viewers will see the modified stream.
Sign up for a free account.
Create an upload preset here, and enable the live-streaming setting. This is also the place to add any wanted effects and transformations under the 'Incoming transformations' section.
fetch the library from npm:
npm install cloudinary-live-stream
After completing the setup, import the library and initialize it. There are two required parameters:
- cloudName - this is the cloud name assigned to you when creating the Cloudinary free account.
- uploadPreset - This is the name of the upload preset created in step two of the setup.
There are several optional parameters:
debug: Log level (disabled by default), one of, or array of
['trace', 'debug', 'vdebug', 'log', 'warn', 'error']. pass in
'all'to print all messages.
bandwidth: Bandwith, in bits. Default is 1Mbit/s (1024 * 1024).
[true/false], When true, will stream live using hls protocol.
[true/false], When true, will save an mp4 file in your Cloudinary media library.
facebookUri: A Facebook streaming URI used to direct the stream to facebook. Supplied by facebook when configuring Facebook streaming.
youtubeUri: A Youtube streaming URI used to direct the stream to Youtube. Supplied by youtube when configuring Youtube streaming.
events: callback for events, supporting the following functions:
start: Called when the streaming starts. Includes the recording Id.
stop: Called when the streaming stops. Includes the recording Id.
error: Called when the library encounters an error. The error message is included in the callback.
local_stream: Called when the stream is available locally (stream is provided in the callback). This can be used to display to the user his own streaming as it up-streams.
// ...// configure your cloud name and the live-stream enabled upload-preset:const cloudName = your-cloud-name;const uploadPreset = your-upload-preset;let liveStreamLibrary;// ...// call initLiveStream with the configuration parameters:
Additional resources are available at:
You can open an issue through GitHub.
Contact us https://cloudinary.com/contact
Join the Community
Impact the product, hear updates, test drive new features and more! Join here.
Released under the MIT license.