Nenhuma descrição

chendeng 64a6cbbe2a 修改readme 2 anos atrás
.hbuilderx 86ea9f51e8 first 2 anos atrás
node_modules 86ea9f51e8 first 2 anos atrás
pages 81e64dca92 sdk添加离开直播间 2 anos atrás
static 86ea9f51e8 first 2 anos atrás
uni_modules 64a6cbbe2a 修改readme 2 anos atrás
unpackage 64a6cbbe2a 修改readme 2 anos atrás
.gitignore c80fc2f1bc add 2 anos atrás
App.vue 86ea9f51e8 first 2 anos atrás
README.md 64a6cbbe2a 修改readme 2 anos atrás
index.html 86ea9f51e8 first 2 anos atrás
main.js 86ea9f51e8 first 2 anos atrás
manifest.json 86ea9f51e8 first 2 anos atrás
package-lock.json 86ea9f51e8 first 2 anos atrás
package.json 86ea9f51e8 first 2 anos atrás
pages.json 86ea9f51e8 first 2 anos atrás
uni.promisify.adaptor.js 86ea9f51e8 first 2 anos atrás
uni.scss 86ea9f51e8 first 2 anos atrás

README.md

项目初始化

npm init -y
npm install crypto-j --save
npm install hashids --save

项目设置

在main.js中添加如下代码:

import stream from '@/uni_modules/equnphp-streaming/components/equnphp-streaming.js'
Vue.prototype.stream = stream

播放端接入

<template>
	<view>
		<equnphp-player></equnphp-player>
	</view>
</template>
export default {
	onLoad(option) {
		this.stream.init({
			httpUrl: "http接口地址",
			wsUrl: "websocket接口地址",
			username: "管理账号",
			password: "管理密码(md5加密以后的密码)",
			key: "api key",
			secret: "spi secret",
			streamId: "直播间ID"
		});
		
		//this.stream.login(0, "万岁是什么鬼", 1)		//当需要创建用户的时候,使用这行代码执行,用户ID为0
		this.stream.login(用户ID)
			.then(data => {
				console.log(data);
				let userId = data.id;
				//编写保存用户ID流程
			})
			.catch(error => {
				console.log(error);
			}
		);
	}
}

推流端接入