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>
|
<template>
|
||||||
<vue-plyr ref="plyr" :options="options">
|
<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>
|
</vue-plyr>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -8,14 +8,12 @@
|
|||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import VuePlyr from 'vue-plyr';
|
import VuePlyr from 'vue-plyr';
|
||||||
import 'vue-plyr/dist/vue-plyr.css';
|
import 'vue-plyr/dist/vue-plyr.css';
|
||||||
import Hls from 'hls.js';
|
// import Hls from 'hls.js';
|
||||||
// import Plyr from 'plyr';
|
// import Plyr from 'plyr';
|
||||||
|
|
||||||
interface IData {
|
interface IData {
|
||||||
options: {};
|
options: {};
|
||||||
player?: typeof VuePlyr;
|
player?: typeof VuePlyr;
|
||||||
mounted: boolean;
|
|
||||||
hls?: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -28,29 +26,21 @@ export default defineComponent({
|
|||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
type: String
|
type: String,
|
||||||
|
default: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data(): IData {
|
data(): IData {
|
||||||
return {
|
return {
|
||||||
player: undefined,
|
player: undefined,
|
||||||
options: {},
|
options: {}
|
||||||
mounted: false,
|
|
||||||
hls: undefined
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async unmounted() {
|
async unmounted() {
|
||||||
console.log('un');
|
|
||||||
this.player?.stop();
|
this.player?.stop();
|
||||||
this.hls?.stopLoad();
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.mounted = true;
|
|
||||||
const video = this.$refs.video as HTMLMediaElement;
|
|
||||||
this.player = (this.$refs.plyr as typeof VuePlyr).player;
|
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>
|
</script>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="19" class="main">
|
<el-col :span="19" class="main">
|
||||||
<div v-if="paid === true || episode?.isFree">
|
<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>
|
||||||
<div v-if="paid === false && !episode?.isFree">
|
<div v-if="paid === false && !episode?.isFree">
|
||||||
{{ $t('course.message.needPay') }}
|
{{ $t('course.message.needPay') }}
|
||||||
@@ -28,10 +28,12 @@ import EpisodePlayer from '@/components/episode/Player.vue';
|
|||||||
import CoursePreviewCard from '@/components/course/PreviewCard.vue';
|
import CoursePreviewCard from '@/components/course/PreviewCard.vue';
|
||||||
import { courseService } from '@/services/course/service';
|
import { courseService } from '@/services/course/service';
|
||||||
import { ICourse, ICourseDetailResponse, ICoursePaidStatusResponse } from '@/services/course/types';
|
import { ICourse, ICourseDetailResponse, ICoursePaidStatusResponse } from '@/services/course/types';
|
||||||
|
import { IResource, IResourceDetailResponse } from '@/services/resource/types';
|
||||||
|
|
||||||
interface IData {
|
interface IData {
|
||||||
course: ICourse | undefined;
|
course: ICourse | undefined;
|
||||||
episode: IEpisode | undefined;
|
episode: IEpisode | undefined;
|
||||||
|
resource: IResource | undefined;
|
||||||
episodes: IEpisode[];
|
episodes: IEpisode[];
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
paid: boolean | undefined;
|
paid: boolean | undefined;
|
||||||
@@ -52,6 +54,7 @@ export default defineComponent({
|
|||||||
episode: undefined,
|
episode: undefined,
|
||||||
loading: false,
|
loading: false,
|
||||||
episodes: [],
|
episodes: [],
|
||||||
|
resource: undefined,
|
||||||
paid: undefined
|
paid: undefined
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -69,6 +72,11 @@ export default defineComponent({
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.episode = data;
|
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 }) => {
|
courseService.paid(this.courseId).then(({ data: { paid } }: { data: ICoursePaidStatusResponse }) => {
|
||||||
this.paid = paid;
|
this.paid = paid;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { AxiosResponse } from 'axios';
|
import { AxiosResponse } from 'axios';
|
||||||
import httpClient from '../instance';
|
import httpClient from '../instance';
|
||||||
|
import { IResourceDetailResponse } from '../resource/types';
|
||||||
import { IEpisode, IEpisodeDetailResponse, IEpisodeListResponse } from './types';
|
import { IEpisode, IEpisodeDetailResponse, IEpisodeListResponse } from './types';
|
||||||
|
|
||||||
class EpisodeService {
|
class EpisodeService {
|
||||||
@@ -13,6 +14,10 @@ class EpisodeService {
|
|||||||
return await httpClient.get(`/${this.key}/${id}`);
|
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>> {
|
async create(data: IEpisode): Promise<AxiosResponse<IEpisodeDetailResponse>> {
|
||||||
return await httpClient.post(`/${this.key}/`, data);
|
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