mirror of
https://github.com/HaishinKit/HaishinKit.swift.git
synced 2026-05-07 20:12:28 +00:00
42 lines
945 B
Swift
42 lines
945 B
Swift
import AVFoundation
|
|
import HaishinKit
|
|
import SwiftUI
|
|
import VideoToolbox
|
|
|
|
struct ContentView: View {
|
|
@ObservedObject var viewModel = ViewModel()
|
|
|
|
private var lfView: MTHKSwiftUiView!
|
|
private var menuView: MenuView!
|
|
|
|
init() {
|
|
viewModel.config()
|
|
lfView = MTHKSwiftUiView(rtmpStream: $viewModel.rtmpStream)
|
|
menuView = MenuView(viewModel: viewModel)
|
|
}
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
lfView
|
|
.ignoresSafeArea()
|
|
.onTapGesture { location in
|
|
self.viewModel.tapScreen(touchPoint: location)
|
|
}
|
|
|
|
menuView
|
|
}
|
|
.onAppear {
|
|
self.viewModel.registerForPublishEvent()
|
|
}
|
|
.onDisappear {
|
|
self.viewModel.unregisterForPublishEvent()
|
|
}
|
|
}
|
|
}
|
|
|
|
struct ContentView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
ContentView()
|
|
}
|
|
}
|