Commit f6fa1eed6cc1b11543487f74f60e68c062daab4e
Committed by
GitHub
Merge pull request #462 from hotcoffie/wvp-28181-2.0
多屏界面,切换分屏数时播放器正确调整尺寸
Showing
2 changed files
with
16 additions
and
6 deletions
web_src/src/components/common/jessibuca.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div ref="container" @dblclick="fullscreenSwich" style="background-color: #eee;margin:0 auto;"> | 2 | + <div ref="container" @dblclick="fullscreenSwich" style="width:100%;height:100%;background-color: #eee;margin:0 auto;"> |
| 3 | <div class="buttons-box" id="buttonsBox"> | 3 | <div class="buttons-box" id="buttonsBox"> |
| 4 | <div class="buttons-box-left"> | 4 | <div class="buttons-box-left"> |
| 5 | <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> | 5 | <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> |
| @@ -74,6 +74,7 @@ export default { | @@ -74,6 +74,7 @@ export default { | ||
| 74 | let dom = this.$refs.container; | 74 | let dom = this.$refs.container; |
| 75 | let width = dom.parentNode.clientWidth | 75 | let width = dom.parentNode.clientWidth |
| 76 | let height = (9 / 16) * width | 76 | let height = (9 / 16) * width |
| 77 | + | ||
| 77 | const clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight) | 78 | const clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight) |
| 78 | if (height > clientHeight) { | 79 | if (height > clientHeight) { |
| 79 | height = clientHeight | 80 | height = clientHeight |
web_src/src/components/live.vue
| @@ -17,7 +17,8 @@ | @@ -17,7 +17,8 @@ | ||
| 17 | :style="liveStyle" :class="{redborder:playerIdx == (i-1)}" | 17 | :style="liveStyle" :class="{redborder:playerIdx == (i-1)}" |
| 18 | @click="playerIdx = (i-1)"> | 18 | @click="playerIdx = (i-1)"> |
| 19 | <div v-if="!videoUrl[i-1]" style="color: #ffffff;font-size: 30px;font-weight: bold;">{{ i }}</div> | 19 | <div v-if="!videoUrl[i-1]" style="color: #ffffff;font-size: 30px;font-weight: bold;">{{ i }}</div> |
| 20 | - <player v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot" @destroy="destroy"/> | 20 | + <player ref="player" v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot" |
| 21 | + @destroy="destroy"/> | ||
| 21 | </div> | 22 | </div> |
| 22 | </div> | 23 | </div> |
| 23 | </el-main> | 24 | </el-main> |
| @@ -59,14 +60,22 @@ export default { | @@ -59,14 +60,22 @@ export default { | ||
| 59 | 60 | ||
| 60 | computed: { | 61 | computed: { |
| 61 | liveStyle() { | 62 | liveStyle() { |
| 63 | + let style = {width: '100%', height: '100%'} | ||
| 62 | switch (this.spilt) { | 64 | switch (this.spilt) { |
| 63 | case 4: | 65 | case 4: |
| 64 | - return {width: '49%', height: '49%'} | 66 | + style = {width: '49%', height: '49%'} |
| 67 | + break | ||
| 65 | case 9: | 68 | case 9: |
| 66 | - return {width: '32%', height: '32%'} | ||
| 67 | - default: | ||
| 68 | - return {width: '100%', height: '100%'} | 69 | + style = {width: '32%', height: '32%'} |
| 70 | + break | ||
| 69 | } | 71 | } |
| 72 | + this.$nextTick(() => { | ||
| 73 | + for (let i = 0; i < this.spilt; i++) { | ||
| 74 | + const player = this.$refs.player | ||
| 75 | + player && player[i] && player[i].updatePlayerDomSize() | ||
| 76 | + } | ||
| 77 | + }) | ||
| 78 | + return style | ||
| 70 | } | 79 | } |
| 71 | }, | 80 | }, |
| 72 | watch: { | 81 | watch: { |