askbot-dragon 0.7.21 → 0.7.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -82,7 +82,7 @@ function ossFileUrl(ossConfig, path, cname) {
|
|
|
82
82
|
function uploadImageByBase64(ossConfig,blob) {
|
|
83
83
|
let ossClient = new OSS(ossConfig);
|
|
84
84
|
|
|
85
|
-
// object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt
|
|
85
|
+
// object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形 式,实现将文件上传至当前Bucket或Bucket下的指定目录。
|
|
86
86
|
let objectKey = pathGenerate(new Date().getTime());
|
|
87
87
|
let result = ossClient.put(objectKey, blob);
|
|
88
88
|
console.debug(result);
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
:raw-controls="true"
|
|
16
16
|
x5-video-player-type="h5-page"
|
|
17
17
|
style="object-fit: contain;width: calc(100vw - 139px);height: 160px;background-color: black;border-radius: 25px;max-width: 230px;padding-left: 10px"
|
|
18
|
-
|
|
18
|
+
preload
|
|
19
19
|
class="video-player vjs-custom-skin"
|
|
20
20
|
:id="msg.keyId+'key'">
|
|
21
21
|
<source :src="videoSrc"/>
|
|
22
22
|
</video>
|
|
23
|
+
<div id="output"></div>
|
|
23
24
|
</div>
|
|
24
25
|
</template>
|
|
25
26
|
<script>
|
|
@@ -50,7 +51,10 @@
|
|
|
50
51
|
mounted() {
|
|
51
52
|
this.$nextTick(()=>{
|
|
52
53
|
this.videoSrc = this.url ? this.url : this.localUrl
|
|
53
|
-
|
|
54
|
+
setTimeout(()=>{
|
|
55
|
+
this.getImage()
|
|
56
|
+
},200)
|
|
57
|
+
|
|
54
58
|
|
|
55
59
|
})
|
|
56
60
|
|
|
@@ -58,11 +62,12 @@
|
|
|
58
62
|
methods:{
|
|
59
63
|
getImage(){
|
|
60
64
|
let that = this
|
|
61
|
-
var video;
|
|
65
|
+
var video,output;
|
|
62
66
|
var scale = 0.8;
|
|
63
67
|
|
|
64
68
|
var initialize = function() {
|
|
65
69
|
let id = that.msg.keyId+'key'
|
|
70
|
+
output = document.getElementById("output");
|
|
66
71
|
video = document.getElementById(id);
|
|
67
72
|
video.addEventListener('loadeddata',captureImage);
|
|
68
73
|
};
|
|
@@ -73,8 +78,10 @@
|
|
|
73
78
|
canvas.height = video.videoHeight * scale;
|
|
74
79
|
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
75
80
|
/*var img = document.createElement("img");
|
|
76
|
-
img.crossOrigin = 'anonymous'
|
|
77
|
-
|
|
81
|
+
img.crossOrigin = 'anonymous'
|
|
82
|
+
img.src = canvas.toDataURL("image/png");*/
|
|
83
|
+
let reg = /\.(png|jpg|gif)$/
|
|
84
|
+
console.debug('img.src',output)
|
|
78
85
|
let base64 = canvas.toDataURL("image/png")
|
|
79
86
|
let blob = that.dataURLtoFile(base64,'name')
|
|
80
87
|
let promise = uploadImageByBase64(ossConfig,blob);
|
|
@@ -82,9 +89,12 @@
|
|
|
82
89
|
console.debug("upload base64 reslut",res);
|
|
83
90
|
if (res&&res.url){
|
|
84
91
|
that.poster = res.url
|
|
92
|
+
if (!reg.test(that.poster)){
|
|
93
|
+
that.poster +='.png'
|
|
94
|
+
}
|
|
85
95
|
}
|
|
96
|
+
console.debug('poster',that.poster)
|
|
86
97
|
});
|
|
87
|
-
/*output.appendChild(img);*/
|
|
88
98
|
};
|
|
89
99
|
|
|
90
100
|
initialize();
|