|
@@ -1,13 +1,24 @@
|
1
|
1
|
import { Modal, Button } from 'antd';
|
2
|
|
-import React from 'react';
|
|
2
|
+import React, { useEffect, useState } from 'react';
|
3
|
3
|
|
4
|
4
|
export default (props) => {
|
5
|
5
|
const { width = 600, height = 480, machineryRef, visible, toggleVisible } = props;
|
6
|
6
|
|
|
7
|
+ const [url, setURL] = useState(
|
|
8
|
+ 'https://yz-offical.oss-cn-shanghai.aliyuncs.com/%E7%9C%81%E5%8F%98%E7%94%B5%E5%9F%B9%E8%AE%AD%E5%9F%BA%E5%9C%B0%E8%A7%86%E9%A2%91%20A%20copy.mov',
|
|
9
|
+ );
|
|
10
|
+
|
7
|
11
|
const handleCancel = () => {
|
8
|
12
|
toggleVisible(false);
|
9
|
13
|
};
|
10
|
14
|
|
|
15
|
+ useEffect(() => {
|
|
16
|
+ // 隐藏的时候取消视频播放
|
|
17
|
+ if (!visible) {
|
|
18
|
+ setURL(undefined);
|
|
19
|
+ }
|
|
20
|
+ }, [visible]);
|
|
21
|
+
|
11
|
22
|
return (
|
12
|
23
|
<Modal
|
13
|
24
|
width={width}
|
|
@@ -16,15 +27,7 @@ export default (props) => {
|
16
|
27
|
onCancel={handleCancel}
|
17
|
28
|
bodyStyle={{ padding: 0 }}
|
18
|
29
|
>
|
19
|
|
- <video
|
20
|
|
- style={{ display: 'block' }}
|
21
|
|
- width={width}
|
22
|
|
- height={height}
|
23
|
|
- controls
|
24
|
|
- src="https://yz-offical.oss-cn-shanghai.aliyuncs.com/%E7%9C%81%E5%8F%98%E7%94%B5%E5%9F%B9%E8%AE%AD%E5%9F%BA%E5%9C%B0%E8%A7%86%E9%A2%91%20A%20copy.mov"
|
25
|
|
- >
|
26
|
|
- <source src="movie.mp4" type="video/mp4" />
|
27
|
|
- <source src="movie.ogg" type="video/ogg" />
|
|
30
|
+ <video style={{ display: 'block' }} width={width} height={height} controls src={url}>
|
28
|
31
|
您的浏览器不支持 video 。
|
29
|
32
|
</video>
|
30
|
33
|
</Modal>
|