add transcode and sign

This commit is contained in:
AceDataCloud committed 2022-10-10 21:21:45 +08:00
1 parent c26fba65a2
commit c020564dc2
9 files changed
+157 -17

No files matched your search

+24 -2
View File
@@ -1,6 +1,6 @@
<template>
<vue-plyr ref="plyr" :options="options">
<video ref="video" controls playsinline :data-poster="preview" :src="resource"></video>
<video ref="video" controls playsinline :data-poster="preview"></video>
</vue-plyr>
</template>
@@ -10,6 +10,7 @@ import VuePlyr from 'vue-plyr';
import 'vue-plyr/dist/vue-plyr.css';
// import Hls from 'hls.js';
// import Plyr from 'plyr';
import TcAdapter from 'tcadapter';
interface IData {
options: {};
@@ -21,7 +22,11 @@ export default defineComponent({
VuePlyr
},
props: {
resource: {
fileId: {
type: String,
required: true
},
sign: {
type: String,
required: true
},
@@ -40,6 +45,23 @@ export default defineComponent({
this.player?.stop();
},
mounted() {
if (!TcAdapter.isSupported()) {
throw new Error('current environment can not support TcAdapter');
}
const adapter = new TcAdapter(
this.$refs.video,
{
appID: '1500015562',
fileID: this.fileId,
psign: this.sign,
hlsConfig: {}
},
() => {
console.log('basicInfo', adapter.getVideoBasicInfo());
}
);
this.player = (this.$refs.plyr as typeof VuePlyr).player;
}
});