...
|
...
|
@@ -13,10 +13,11 @@ |
13
|
13
|
PauseOutlined,
|
14
|
14
|
CaretDownOutlined,
|
15
|
15
|
CaretLeftOutlined,
|
16
|
|
- PlusOutlined,
|
17
|
|
- MinusOutlined,
|
|
16
|
+ ZoomInOutlined,
|
|
17
|
+ ZoomOutOutlined,
|
18
|
18
|
} from '@ant-design/icons-vue';
|
19
|
19
|
import { Button } from 'ant-design-vue';
|
|
20
|
+ import { nextTick } from 'vue';
|
20
|
21
|
const { prefixCls } = useDesign('basic-video-play');
|
21
|
22
|
|
22
|
23
|
const props = defineProps<{
|
...
|
...
|
@@ -31,8 +32,6 @@ |
31
|
32
|
|
32
|
33
|
const videoPlayEl = ref<HTMLVideoElement>();
|
33
|
34
|
|
34
|
|
- const isPlay = ref<Boolean>(true); //是否是播放状态
|
35
|
|
-
|
36
|
35
|
const videoPlayInstance = ref<Nullable<VideoJsPlayer>>();
|
37
|
36
|
|
38
|
37
|
const getOptions = computed(() => {
|
...
|
...
|
@@ -82,19 +81,29 @@ |
82
|
81
|
|
83
|
82
|
//type 1:上 2:右 3:下 4:左 5:暂停
|
84
|
83
|
const handleClick = (type: number) => {
|
85
|
|
- console.log(type, 'type');
|
86
|
84
|
if (type == 5) {
|
87
|
|
- isPlay.value = !unref(isPlay);
|
|
85
|
+ // if (unref(isPlay)) {
|
|
86
|
+ // unref(videoPlayInstance)?.play();
|
|
87
|
+ // } else {
|
|
88
|
+ // unref(videoPlayInstance)?.pause();
|
|
89
|
+ // }
|
|
90
|
+ isPlay.value = !isPlay.value;
|
88
|
91
|
}
|
89
|
92
|
};
|
90
|
93
|
|
91
|
94
|
// type 1:放大 2:缩小
|
92
|
95
|
const handleScale = (type: number) => {
|
93
|
|
- console.log(type, 'type');
|
|
96
|
+ if (type == 1) {
|
|
97
|
+ } else {
|
|
98
|
+ }
|
94
|
99
|
};
|
95
|
100
|
|
96
|
|
- onMounted(() => {
|
|
101
|
+ const isPlay = ref<Boolean | null | undefined>(true);
|
|
102
|
+
|
|
103
|
+ onMounted(async () => {
|
97
|
104
|
init();
|
|
105
|
+ await nextTick();
|
|
106
|
+ isPlay.value = unref(videoPlayInstance)?.paused();
|
98
|
107
|
});
|
99
|
108
|
|
100
|
109
|
onUnmounted(() => {
|
...
|
...
|
@@ -127,7 +136,9 @@ |
127
|
136
|
<CaretLeftOutlined class="front-sty-left child-icon" @click="handleClick(3)" />
|
128
|
137
|
|
129
|
138
|
<Button class="front-sty-center child center" shape="circle" @click="handleClick(5)">
|
130
|
|
- <PauseOutlined v-if="isPlay" class="child-icon" style="color: #fffbfb" />
|
|
139
|
+ <!-- 暂停 -->
|
|
140
|
+ <PauseOutlined v-if="!isPlay" class="child-icon" style="color: #fffbfb" />
|
|
141
|
+ <!-- 播放 -->
|
131
|
142
|
<CaretRightOutlined v-else class="child-icon" style="color: #fffbfb" />
|
132
|
143
|
</Button>
|
133
|
144
|
|
...
|
...
|
@@ -154,10 +165,10 @@ |
154
|
165
|
</div>
|
155
|
166
|
<div class="flex justify-center mt-8">
|
156
|
167
|
<Button shape="circle" class="button-icon" @click="handleScale(1)">
|
157
|
|
- <PlusOutlined style="color: #315a9c; font-size: 1.5rem" />
|
|
168
|
+ <ZoomInOutlined style="color: #315a9c; font-size: 1.5rem" />
|
158
|
169
|
</Button>
|
159
|
170
|
<Button shape="circle" class="ml-10 button-icon" @click="handleScale(2)">
|
160
|
|
- <MinusOutlined style="color: #315a9c; font-size: 1.5rem" />
|
|
171
|
+ <ZoomOutOutlined style="color: #315a9c; font-size: 1.5rem" />
|
161
|
172
|
</Button>
|
162
|
173
|
</div>
|
163
|
174
|
</div>
|
...
|
...
|
|