RayStreaming launcher
import { Launcher } from 'live-qjc'
// NOTE: token, signaling address and iceServers were provided by qjcloud
const signaling = 'wss://xxx.xxx.xxx.xxx:xxxx'
const token = 'xxxxxxxxxxxxxxxxxxxxxxxx'
const iceConfig = [
{
urls: 'turn:xxx.xxx.xxx.xxx',
username: 'xxxxxx',
credential: 'xxxxxx',
},
{
urls: 'stun:xxx.xxx.xxx.xxx',
username: 'xxxxxx',
credential: 'xxxxx',
},
]
const container = document.createElement('div')
container.style.width = 'auto'
container.style.height = '100%'
document.body.appendChild(container)
const launcher = new Launcher(`${signaling}/clientWebsocket/${token}`, iceConfig, container)
launcher.showLoadingContent(text, loadingBgImage)
-
text
<string> -
loadingBgImage
<string>
launcher.hideLoadingContent()
launcher.getLastFrame(accuracy, alpha)
-
accuracy
<number> -
alpha
<number>
// NOTE: return an object
const report = launcher.getRivatunerInfo()
console.log(`
FPS: ${fps}
biterate: ${bitrate}kbps
latency: ${latency}ms
averageJitterBufferDelay: ${averageJitterBufferDelay}ms
packetLossRate: ${(packetLossRate * 100).toFixed(3)}%
`)
launcher.disConnection()
launcher.setFullScreen()
launcher.exitFullScreen()
launcher.changeFrameRate(framerate)
-
framerate
<number> fps
launcher.changeBitrate(bitrate)
-
bitrate
<number> kbps
launcher.changeResolution(width, height)
-
width
<number> -
height
<number>
launcher.uploadSingleFile(file)
launcher.sendFileResponse()
launcher.setFileAuthority(permission)
-
permission
<boolean>