rbi-streaming
v0.1.0-beta.0
Published
rbi-streaming launcher for rbi
Downloads
3
Readme
rbi-streaming Launcher
rbi-streaming launcher
Quick start
import { Launcher } from 'rbi-streaming'
const address = 'xxxxxx'
const replaceWs = 'xxxxxx'
const appKey = 'xxxxxxx'
let appSecret
let launcher
async function bootstrap() {
const baseOptionsType = {
address,
replaceWs,
appKey,
startType: 1,
}
const container = document.querySelector('body')
document.querySelector('body').style.width = '100%'
document.querySelector('body').style.height = '100%'
const uiOptions = {
onPlay: () => {
console.log('出现了有效画面')
//web端->应用
launcher.launcherBase.connection.emitUIInteraction('发给应用的数据').then((res) => {
console.log(res ? '发送成功' : '发送失败')
})
},
}
launcher = new Launcher(baseOptionsType, container, uiOptions)
}
window.addEventListener('DOMContentLoaded', () => {
if (navigator.userAgent.includes('miniProgram') || navigator.userAgent.includes('MicroMessenger')) {
new Promise((resolve, reject) => {
document.addEventListener('WeixinJSBridgeReady', resolve)
}).then(bootstrap)
} else {
bootstrap()
}
})
Destory
launcher.destory([errMsg])