add water mark via tencent cloud
This commit is contained in:
1 parent
4a6a697ddf
commit
c26fba65a2
4 files changed
+31
-16
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<vue-plyr ref="plyr" :options="options">
|
||||
<video ref="video" controls playsinline :data-poster="preview"></video>
|
||||
<video ref="video" controls playsinline :data-poster="preview" :src="resource"></video>
|
||||
</vue-plyr>
|
||||
</template>
|
||||
|
||||
@@ -8,14 +8,12 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import VuePlyr from 'vue-plyr';
|
||||
import 'vue-plyr/dist/vue-plyr.css';
|
||||
import Hls from 'hls.js';
|
||||
// import Hls from 'hls.js';
|
||||
// import Plyr from 'plyr';
|
||||
|
||||
interface IData {
|
||||
options: {};
|
||||
player?: typeof VuePlyr;
|
||||
mounted: boolean;
|
||||
hls?: any;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
@@ -28,29 +26,21 @@ export default defineComponent({
|
||||
required: true
|
||||
},
|
||||
preview: {
|
||||
type: String
|
||||
type: String,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
player: undefined,
|
||||
options: {},
|
||||
mounted: false,
|
||||
hls: undefined
|
||||
options: {}
|
||||
};
|
||||
},
|
||||
async unmounted() {
|
||||
console.log('un');
|
||||
this.player?.stop();
|
||||
this.hls?.stopLoad();
|
||||
},
|
||||
mounted() {
|
||||
this.mounted = true;
|
||||
const video = this.$refs.video as HTMLMediaElement;
|
||||
this.player = (this.$refs.plyr as typeof VuePlyr).player;
|
||||
this.hls = new Hls() as Hls;
|
||||
this.hls?.loadSource(this.resource);
|
||||
this.hls?.attachMedia(video);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -10,7 +10,7 @@
|
||||
</el-col>
|
||||
<el-col :span="19" class="main">
|
||||
<div v-if="paid === true || episode?.isFree">
|
||||
<episode-player v-if="episode?.resourceUrl" :resource="episode?.resourceUrl" :preview="episode?.thumbnail" />
|
||||
<episode-player v-if="resource?.url" :resource="resource?.url" :preview="episode?.thumbnail" />
|
||||
</div>
|
||||
<div v-if="paid === false && !episode?.isFree">
|
||||
{{ $t('course.message.needPay') }}
|
||||
@@ -28,10 +28,12 @@ import EpisodePlayer from '@/components/episode/Player.vue';
|
||||
import CoursePreviewCard from '@/components/course/PreviewCard.vue';
|
||||
import { courseService } from '@/services/course/service';
|
||||
import { ICourse, ICourseDetailResponse, ICoursePaidStatusResponse } from '@/services/course/types';
|
||||
import { IResource, IResourceDetailResponse } from '@/services/resource/types';
|
||||
|
||||
interface IData {
|
||||
course: ICourse | undefined;
|
||||
episode: IEpisode | undefined;
|
||||
resource: IResource | undefined;
|
||||
episodes: IEpisode[];
|
||||
loading: boolean;
|
||||
paid: boolean | undefined;
|
||||
@@ -52,6 +54,7 @@ export default defineComponent({
|
||||
episode: undefined,
|
||||
loading: false,
|
||||
episodes: [],
|
||||
resource: undefined,
|
||||
paid: undefined
|
||||
};
|
||||
},
|
||||
@@ -69,6 +72,11 @@ export default defineComponent({
|
||||
this.loading = false;
|
||||
this.episode = data;
|
||||
});
|
||||
episodeService.resource(this.id).then(({ data: data }: { data: IResourceDetailResponse }) => {
|
||||
// this.loading = false;
|
||||
// this.episode = data;
|
||||
this.resource = data;
|
||||
});
|
||||
courseService.paid(this.courseId).then(({ data: { paid } }: { data: ICoursePaidStatusResponse }) => {
|
||||
this.paid = paid;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import httpClient from '../instance';
|
||||
import { IResourceDetailResponse } from '../resource/types';
|
||||
import { IEpisode, IEpisodeDetailResponse, IEpisodeListResponse } from './types';
|
||||
|
||||
class EpisodeService {
|
||||
@@ -13,6 +14,10 @@ class EpisodeService {
|
||||
return await httpClient.get(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
async resource(id: number): Promise<AxiosResponse<IResourceDetailResponse>> {
|
||||
return await httpClient.get(`/${this.key}/${id}/resource/`);
|
||||
}
|
||||
|
||||
async create(data: IEpisode): Promise<AxiosResponse<IEpisodeDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/`, data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
export interface IResource {
|
||||
id: string;
|
||||
url?: string;
|
||||
state?: string;
|
||||
taskId?: string;
|
||||
watermarks?: string[];
|
||||
episode?: number;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export type IResourceDetailResponse = IResource;
|
||||
Reference in new issue
Block a user