@livuvo/short
v0.0.2
Published
# Connecting to WebSocket ```javascript import { Connector } from "@livuvo/short";
Downloads
3
Readme
Short Video Sdk
Connecting to WebSocket
import { Connector } from "@livuvo/short";
const connector = new Connector();
console.log("connection status", connector.status.get());
connector.status.subscribe((value) => {
console.log("connection status", value);
if(value === Connector.CONNECTION_STATUS.CONNECTED){
console.log('connected successfully');
/**
* Now you can sen events to server using publish method
* for example:
*/
connector.publish('like');
}
});
client.connect({
user_id: string,
token: string,
scope: "short",
space_slug: string,
slug: string,
session: string,
});
Loading video
import { createVideoPlayer } from "@livuvo/short";
const videoPlayer = createVideoPlayer({
src: "https://streamer.interactify.live/interactify-videos/short/55d45519b9e243acaed622bd9eaad5f4/hls/55d45519b9e243acaed622bd9eaad5f4.m3u8",
});
document.body.appendChild(videoPlayer.element);
videoPlayer.element.autoplay = true;
videoPlayer.element.controls = true;