VPCamera/tdvideo/tdvideo/VideoFile.swift
2024-03-05 11:44:34 +08:00

36 lines
819 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// VideoFile.swift
// vp
//
// Created by soldoros on 2024/1/17.
//
import SwiftUI
import UniformTypeIdentifiers
///' FileDocument 'SwiftUI' fileexporters '
struct VideoFile: FileDocument {
static var readableContentTypes: [UTType] = [.movie, .quickTimeMovie, .mpeg4Movie]
// empty data
var data: Data
init() {
self.data = Data()
}
init(configuration: ReadConfiguration) throws {
if let readData = configuration.file.regularFileContents {
data = readData
} else {
data = Data()
}
}
func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
FileWrapper(regularFileWithContents: data)
}
}