Improve video command
This commit is contained in:
@ -35,6 +35,9 @@ struct InsertableVideo: View, InsertableCommandView {
|
||||
@Published
|
||||
var preload = false
|
||||
|
||||
@Published
|
||||
var preloadType: VideoBlock.Option.Preload = .metadata
|
||||
|
||||
var isReady: Bool {
|
||||
videoH265 != nil || videoH264 != nil
|
||||
}
|
||||
@ -63,7 +66,9 @@ struct InsertableVideo: View, InsertableCommandView {
|
||||
if loop { lines.append(VideoBlock.Key.loop.rawValue) }
|
||||
if muted { lines.append(VideoBlock.Key.muted.rawValue) }
|
||||
if playsinline { lines.append(VideoBlock.Key.playsinline.rawValue) }
|
||||
if preload { lines.append(VideoBlock.Key.preload.rawValue) }
|
||||
if preload {
|
||||
lines.append("\(VideoBlock.Key.preload.rawValue):\(preloadType.rawValue)")
|
||||
}
|
||||
|
||||
lines.append("```")
|
||||
return lines.joined(separator: "\n")
|
||||
@ -104,11 +109,20 @@ struct InsertableVideo: View, InsertableCommandView {
|
||||
Toggle("controls", isOn: $model.controls)
|
||||
Toggle("autoplay", isOn: $model.autoplay)
|
||||
Toggle("loop", isOn: $model.loop)
|
||||
}
|
||||
HStack {
|
||||
Toggle("muted", isOn: $model.muted)
|
||||
Toggle("playsinline", isOn: $model.playsinline)
|
||||
Spacer()
|
||||
}
|
||||
HStack {
|
||||
Toggle("preload", isOn: $model.preload)
|
||||
Picker("", selection: $model.preloadType) {
|
||||
ForEach(VideoBlock.Option.Preload.allCases, id: \.rawValue) { type in
|
||||
Text("\(type.rawValue)").tag(type)
|
||||
}
|
||||
}
|
||||
.disabled(!model.preload)
|
||||
.frame(maxWidth: 100)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.toggleStyle(.checkbox)
|
||||
|
Reference in New Issue
Block a user