Services in Preview

Some services are currently under development in the Crewdle SDK. In an upcoming update, we plan to release a Media Stream service, allowing you to use our decentralized platform to power audio and video streaming. This service is currently in preview mode as we work on stability and scalability to bring you the best version of what it can be. You may request an early access through your Developer Console.

Media Stream

After creating an SDK instance, you are able to publish a stream to the cluster and other users are able to subscribe to the stream and use the different tracks as they wish.

import { MediaStreamPriority } from '@crewdle/web-sdk-types';

// User 1
const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
localDynamicMediaStream = cluster.publishLocalDynamicMediaStream('main', stream);
localDynamicMediaStream.setPriority(MediaStreamPriority.High);

// User 2
const video = document.getElementById('HTMLVideoElement') as HTMLVideoElement;
stream.subscribe({ video: { renderElement: video }, audio: true });
// Fetch the tracks
const mediaStream = cluster.getRemoteMediaStreams()[0];

Additional Resources

See the Getting Started section for more information about initiating the SDK and a cluster.

To see a full example of a Pub/Sub being used, checkout our github. For more information on the services used in this page, head to our SDK reference