@dao42/d42paas_rtc
v1.0.7
Published
RTC Server && RTC SDK
Downloads
20
Readme
D42RTC
RTC Server && RTC SDK
Webapp
Debug user
http://localhost:3000/?cid=local-test&uid=1&sid=1&apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
# simulation event
http://localhost:3000/admin/
Depend
npm install @pano.video/panortc
npm install agora-rtc-sdk-ng
npm install flv.js
npm install hls.js
Example: Rtc
import { D42RTC, Events, ID } from '@dao42/d42paas_rtc'
import AgoraRTC from 'agora-rtc-sdk-ng'
import PanoRtc from '@pano.video/panortc'
const currentID = {
cid: "1",
uid: "1",
sid: "1",
}
const d42rtc = new D42RTC({
id: currentID,
server: "http://develop.1024paas.com",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
dep: {
agora: AgoraRTC,
pano: PanoRtc,
},
})
d42rtc.join()
Example: Playback
import { Playback } from '@dao42/d42paas_rtc'
import flvjs from 'flv.js'
import Hls from 'hls.js'
const playback = new Playback(
"http://develop.1024paas.com",
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
{
hls: Hls,
flv: flvjs,
},
)
// Play Default player
await playback.playMedia("<mediaId>", "<HTMLVideoElement>")
// Destroy
playback.destroy()
// Get Media src, use custom player
const media = await playback.getMedia("<mediaId>")
// media: {
// contentType:
// url:
// }