File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed
metadata/admin/charcoal/property Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "admin" : {
3
+ "input_type" : " charcoal/admin/property/input/video" ,
4
+ "display_type" : " charcoal/admin/property/display/video"
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Charcoal \Property ;
4
+
5
+ // From 'charcoal-property'
6
+ use Charcoal \Property \FileProperty ;
7
+
8
+ /**
9
+ * Video Property.
10
+ *
11
+ * The video property is a specialized file property that handles video file.
12
+ */
13
+ class VideoProperty extends FileProperty
14
+ {
15
+ /**
16
+ * @return string
17
+ */
18
+ public function type ()
19
+ {
20
+ return 'video ' ;
21
+ }
22
+
23
+ /**
24
+ * Retrieves the default list of acceptable MIME types for uploaded files.
25
+ *
26
+ * This method should be overriden.
27
+ *
28
+ * @return string[]
29
+ */
30
+ public function getDefaultAcceptedMimetypes ()
31
+ {
32
+ return [
33
+ 'video/mp4 ' ,
34
+ 'video/webm ' ,
35
+ 'video/ogg ' ,
36
+ 'video/ogv ' ,
37
+ 'video/x-matroska ' ,
38
+ ];
39
+ }
40
+
41
+ /**
42
+ * Resolve the file extension from the given MIME type.
43
+ *
44
+ * @param string $type The MIME type to resolve.
45
+ * @return string|null The extension based on the MIME type.
46
+ */
47
+ protected function resolveExtensionFromMimeType ($ type )
48
+ {
49
+ switch ($ type ) {
50
+ case 'video/mp4 ' :
51
+ return 'mp4 ' ;
52
+
53
+ case 'video/webm ' :
54
+ return 'webm ' ;
55
+
56
+ case 'video/ogg ' :
57
+ case 'video/ogv ' :
58
+ return 'ogv ' ;
59
+
60
+ case 'video/x-matroska ' :
61
+ return 'mkv ' ;
62
+ }
63
+
64
+ return null ;
65
+ }
66
+ }
You can’t perform that action at this time.
0 commit comments