feat:视频支持HLS协议
Showing
2 changed files
with
6 additions
and
8 deletions
... | @@ -14,6 +14,7 @@ | ... | @@ -14,6 +14,7 @@ |
14 | 14 | ||
15 | <script> | 15 | <script> |
16 | import videojs from 'video.js' | 16 | import videojs from 'video.js' |
17 | import video_zhCN from 'video.js/dist/lang/zh-CN.json' | ||
17 | import { throttle } from '@/utils/util' | 18 | import { throttle } from '@/utils/util' |
18 | const mirrerIcon = | 19 | const mirrerIcon = |
19 | '<svg t="1594374364946" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2814" width="16" height="16"><path d="M424.2 230.4c0.6 0.2 1.2 0.4 1.6 0.5L160.6 148c-2.9-0.6-6-0.9-9.2-0.9-24.5 0-44.4 19.9-44.4 44.4v634.8c0 24.6 19.9 44.5 44.4 44.5 3.2 0 6.2-0.4 9.2-0.9L432.4 785c17.9-9.2 30.1-27.9 30.1-49.3V283.2c-0.1-24.6-16.1-45.6-38.3-52.8z m-28.4 485.9l-222.1 59.2V242.3l222.1 59.2v414.8z m466.4-569.2c-3.2 0-6.2 0.4-9.2 0.9l-262 82c0.4-0.1 0.7-0.1 0.9-0.2-23.5 6.5-40.8 28-40.8 53.5v452.3c0 21.5 12.2 40.1 30.1 49.4l271.6 84.9c2.9 0.6 6.1 0.9 9.3 0.9 24.5 0 44.4-19.9 44.4-44.5V191.5c0.2-24.5-19.7-44.4-44.3-44.4z" p-id="2815" fill="#ffffff"></path></svg>' | 20 | '<svg t="1594374364946" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2814" width="16" height="16"><path d="M424.2 230.4c0.6 0.2 1.2 0.4 1.6 0.5L160.6 148c-2.9-0.6-6-0.9-9.2-0.9-24.5 0-44.4 19.9-44.4 44.4v634.8c0 24.6 19.9 44.5 44.4 44.5 3.2 0 6.2-0.4 9.2-0.9L432.4 785c17.9-9.2 30.1-27.9 30.1-49.3V283.2c-0.1-24.6-16.1-45.6-38.3-52.8z m-28.4 485.9l-222.1 59.2V242.3l222.1 59.2v414.8z m466.4-569.2c-3.2 0-6.2 0.4-9.2 0.9l-262 82c0.4-0.1 0.7-0.1 0.9-0.2-23.5 6.5-40.8 28-40.8 53.5v452.3c0 21.5 12.2 40.1 30.1 49.4l271.6 84.9c2.9 0.6 6.1 0.9 9.3 0.9 24.5 0 44.4-19.9 44.4-44.5V191.5c0.2-24.5-19.7-44.4-44.3-44.4z" p-id="2815" fill="#ffffff"></path></svg>' |
... | @@ -101,7 +102,10 @@ export default { | ... | @@ -101,7 +102,10 @@ export default { |
101 | // 重新设置video的视频来源 | 102 | // 重新设置video的视频来源 |
102 | if (this.player) { | 103 | if (this.player) { |
103 | this.player.pause() | 104 | this.player.pause() |
104 | this.player.src(val) | 105 | this.player.src({ |
106 | src: val, | ||
107 | type: 'application/x-mpegURL' | ||
108 | }) | ||
105 | this.player.load() | 109 | this.player.load() |
106 | } | 110 | } |
107 | } | 111 | } |
... | @@ -115,11 +119,6 @@ export default { | ... | @@ -115,11 +119,6 @@ export default { |
115 | this.player.dispose() | 119 | this.player.dispose() |
116 | } | 120 | } |
117 | }, | 121 | }, |
118 | // TODO 确认是否删除 | ||
119 | // beforeRouteLeave(to, from, next) { | ||
120 | // this.stopVideo() | ||
121 | // next() | ||
122 | // }, | ||
123 | methods: { | 122 | methods: { |
124 | init() { | 123 | init() { |
125 | this.player = videojs( | 124 | this.player = videojs( |
... | @@ -158,7 +157,6 @@ export default { | ... | @@ -158,7 +157,6 @@ export default { |
158 | // this.player.play() | 157 | // this.player.play() |
159 | // }) | 158 | // }) |
160 | // }) | 159 | // }) |
161 | this.player.src(this.url) | ||
162 | }, | 160 | }, |
163 | timeupdate() { | 161 | timeupdate() { |
164 | // 获取视频当前播放时间 | 162 | // 获取视频当前播放时间 | ... | ... |
... | @@ -124,7 +124,7 @@ export default { | ... | @@ -124,7 +124,7 @@ export default { |
124 | recordId: this.custInfoCopy.recordId | 124 | recordId: this.custInfoCopy.recordId |
125 | }) | 125 | }) |
126 | this.form.remarks = monitorRemarks | 126 | this.form.remarks = monitorRemarks |
127 | this.videoUrl = url | 127 | this.videoUrl = url.replace('http', 'https') |
128 | } catch (error) { | 128 | } catch (error) { |
129 | console.log(error) | 129 | console.log(error) |
130 | } | 130 | } | ... | ... |
-
Please register or sign in to post a comment