|
|
1 年之前 | |
|---|---|---|
| .hbuilderx | 1 年之前 | |
| components | 2 年之前 | |
| node_modules | 2 年之前 | |
| pages | 1 年之前 | |
| uni_modules | 1 年之前 | |
| unpackage | 1 年之前 | |
| App.vue | 2 年之前 | |
| README.md | 1 年之前 | |
| index.html | 2 年之前 | |
| main.js | 2 年之前 | |
| manifest.json | 1 年之前 | |
| package-lock.json | 2 年之前 | |
| package.json | 1 年之前 | |
| pages.json | 1 年之前 | |
| uni.promisify.adaptor.js | 2 年之前 | |
| uni.scss | 2 年之前 |
npm init -y
npm install crypto-js --save
npm install hashids --save
引入uni_modules包 manifest.json app插件配置腾讯直播插件
<template>
<view>
<RY-TencentLive-Pusher class="live" ref="livePusher" v-bind:style="{ width: playerWidth, height: playerHeight,background: '#252e37' }"></RY-TencentLive-Pusher>
<live-push ref="livePush" @goDetail="goDetail" @buyGoods="buyGoods" @shearRoom="shearRoom">
<template v-slot:goodsDetail>
<view style="width: 100%;height: 300px;background-color: darkcyan;margin-bottom: 10px;border-radius: 20rpx 20rpx 0 0;">
商品详情
</view>
</template>
</live-push>
</view>
</template>
import stream from '@/uni_modules/equnphp-streaming/components/equnphp-streaming.js';
export default {
data() {
return {
playerWidth:uni.getSystemInfoSync().windowWidth,
playerHeight:uni.getSystemInfoSync().windowHeight
}
},
onLoad(option) {
let self = this
this.$nextTick(function() {
// 直播初始化
stream.init({
liveId: option.live_id,
userId: option.user_id,
nickName: option.nick_name,
livePusher: self.$refs.livePusher,
playerWidth: self.playerWidth,
playerHeight: self.playerHeight,
liveType: 'push'
});
})
},
methods:{
// 商品详情
goDetail(data) {
console.log("商品详情",data)
},
// 去抢购
buyGoods(data) {
console.log("去抢购",data)
},
// 分享
shearRoom(data){
console.log("分享",data)
}
}
}
<template>
<view>
<!-- #ifdef APP-PLUS -->
<RY-TencentLive-Player class="live" ref="livePlayer" v-bind:style="{ width: playerWidth, height: playerHeight, background: '#252e37' }"></RY-TencentLive-Player>
<!-- #endif -->
<live-play ref="livePlay" @goDetail="goDetail" @buyGoods="buyGoods">
<template v-slot:goodsDetail>
<view style="width: 100%;height: 300px;background-color: darkcyan;margin-bottom: 10px;border-radius: 20rpx 20rpx 0 0;">
商品详情
</view>
</template>
</live-play>
</view>
</template>
import stream from '@/uni_modules/equnphp-streaming/components/equnphp-streaming.js';
export default {
data() {
return {
playerWidth:uni.getSystemInfoSync().windowWidth,
playerHeight:uni.getSystemInfoSync().windowHeight
}
},
onLoad(option) {
let self = this
this.$nextTick(function() {
// 直播初始化
stream.init({
liveId: option.live_id,
merId: option.merId,
userId: option.user_id,
nickName: option.nick_name,
livePlayer: self.$refs.livePlayer,
playerWidth: self.playerWidth,
playerHeight: self.playerHeight,
liveType: 'play'
});
})
},
methods:{
// 商品详情
goDetail(data) {
console.log("商品详情",data)
},
// 去抢购
buyGoods(data) {
console.log("去抢购",data)
}
}
}