Add m4v video support
This commit is contained in:
parent
4fd61a5a69
commit
534cdf989f
@ -8,19 +8,22 @@ private let supportedImageExtensions: [String : NSBitmapImageRep.FileType] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
private let supportedVideoExtensions: Set<String> = [
|
private let supportedVideoExtensions: Set<String> = [
|
||||||
"mp4", "mov"
|
"mp4", "mov", "m4v"
|
||||||
]
|
]
|
||||||
|
|
||||||
enum MediaType {
|
enum MediaType {
|
||||||
case image
|
case image
|
||||||
case video
|
case video
|
||||||
case file
|
case file
|
||||||
|
case svg
|
||||||
|
|
||||||
init(fileExtension: String) {
|
init(fileExtension: String) {
|
||||||
if supportedImageExtensions[fileExtension] != nil {
|
if supportedImageExtensions[fileExtension] != nil {
|
||||||
self = .image
|
self = .image
|
||||||
} else if supportedVideoExtensions.contains(fileExtension) {
|
} else if supportedVideoExtensions.contains(fileExtension) {
|
||||||
self = .video
|
self = .video
|
||||||
|
} else if fileExtension == "svg" {
|
||||||
|
self = .svg
|
||||||
} else {
|
} else {
|
||||||
self = .file
|
self = .file
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,14 @@ import Foundation
|
|||||||
|
|
||||||
enum VideoType: String {
|
enum VideoType: String {
|
||||||
case mp4
|
case mp4
|
||||||
|
case m4v
|
||||||
|
|
||||||
var htmlType: String {
|
var htmlType: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .mp4:
|
case .mp4:
|
||||||
return "video/mp4"
|
return "video/mp4"
|
||||||
|
case .m4v:
|
||||||
|
return "video/mp4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user