linevideo.vue
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!-- <template lang="pug">
div#app
div#header
comp-header
div#content
div#left
comp-player(ref="player")
div#right
comp-message(ref="message")
</template>
<script>
import '@/assets/style/black-element-ui.styl'
import LibGenerateTestUserSig from '@/utils/lib-generate-test-usersig.min.js'
// import compHeader from '@/components/comp-header';
// import compPlayer from '@/components/comp-player';
// import compMessage from '@/components/comp-message';
import {
SET_SDK_APP_ID,
SET_USER_SIG,
SET_PLAYER_DOMAIN,
SET_ROOM_ID,
SET_ROOM_NAME,
UPDATE_USER_INFO,
SET_ANCHOR_USER_ID
} from '@/constants/mutation-types'
// import { mapState } from 'vuex';
export default {
components: {
// compHeader,
// compPlayer,
// compMessage,
},
name: 'Linevideo',
data () {
return {
sdkAppId: 1400619266,
expireTime: 604800,
secretKey: '6c52cd3d7b04c90060dfe7ce7e37750ac27522bbc6f2ff0847c79f836bc62e70',
roomInfo: {
roomId: 6,
roomName: '直播测试'
},
anchorUserInfo: {
userId: '5',
userName: '阿里-刘进永',
userAvatar: '的撒的撒 '
},
userInfo: {
userId: 'user_audience',
userName: `观众${Math.floor(Math.random() * 100)}`,
userAvatar: ''
},
playerDomain: ''
}
},
computed: {
// ...mapState({
// userInfo: 'userInfo',
// roomId: 'roomId',
// }),
},
methods: {
handlePlayerInfo () {
if (this.sdkAppId === '' || this.secretKey === '') {
alert(`${this.$t('basic.Please configure your SDKAPPID')}\r\n\r\nconfig/basic-info-config.js`)
}
const generator = new LibGenerateTestUserSig(this.sdkAppId, this.secretKey, this.expireTime)
const userSig = generator.genTestUserSig(this.userInfo.userId)
this.$store.commit(SET_SDK_APP_ID, this.sdkAppId)
this.$store.commit(SET_USER_SIG, userSig)
this.$store.commit(SET_PLAYER_DOMAIN, this.playerDomain)
this.$store.commit(SET_ROOM_ID, this.roomInfo.roomId)
this.$store.commit(SET_ROOM_NAME, this.roomInfo.roomName)
this.$store.commit(SET_ANCHOR_USER_ID, this.anchorUserInfo.userId)
this.$store.commit(UPDATE_USER_INFO, {
userId: this.userInfo.userId,
userName: this.userInfo.userName,
userAvatar: this.userInfo.userAvatar
})
},
// 退出直播间
async handleExit () {
// 处理退出直播间
},
// 退出登录
async handleLogout () {
// 处理退出登录
}
},
created () {
this.handlePlayerInfo()
// this.$eventBus.$on('exit', this.handleExit);
// this.$eventBus.$on('logout', this.handleLogout);
},
beforeDestroy () {
// this.$eventBus.$off('exit', this.handleExit);
// this.$eventBus.$on('logout', this.handleLogout);
}
}
</script>
<style lang="stylus">
#app
font-family Avenir, Helvetica, Arial, sans-serif
-webkit-font-smoothing antialiased
-moz-osx-font-smoothing grayscale
text-align center
background-color $backgroundColor
color $fontColor
width 100%
height 100%
position relative
#header
width 100%
height 52px
background-color $themeColor
#content
width 100%
position absolute
left 0
bottom 0
top 52px
display flex
#left
height 100%
flex-grow 1
background-color $backgroundColor
#right
width 30%
min-width 300px
max-width 406px
height 100%
background-color $IMThemeColor
</style> -->