| | |
| | | DeviceInfo(name: "话筒", type: .MICROPHONE,deviceId: UUID().uuidString,icon: Icons.MIC), |
| | | DeviceInfo(name: "系统", type: .SYSTEM,deviceId : UUID().uuidString,icon: Icons.PORTRAIT)] |
| | | |
| | | @State private var miniWindows:Array<MiniWindowData> = [] |
| | | |
| | | @StateObject private var mViewModel = LiveViewModel() |
| | | |
| | |
| | | ZStack{ |
| | | Color.clear |
| | | .ignoresSafeArea() // 填满全屏 |
| | | VStack{ |
| | | ZStack{ |
| | | VideoRendererView(pixelBuffer: $mViewModel.pixelBuffer).background(Color.black).frame(width: mainSize.width,height:mainSize.height) |
| | | Spacer() |
| | | .frame(maxWidth: .infinity,maxHeight: .infinity,alignment: .topTrailing) |
| | | ForEach(miniWindows, id: \.id) { miniWindow in |
| | | NewMiniWindow(miniWindow: miniWindow) |
| | | } |
| | | }.border(Color.blue) |
| | | |
| | | VStack{ |
| | | Spacer() |
| | | BottomBtns().frame(alignment: .bottom).border(Color.green) |
| | |
| | | withAnimation{ |
| | | showDeviceDialog = false; |
| | | } |
| | | miniWindows.append(MiniWindowData(streamType: device.type)) |
| | | } |
| | | print("\(device.name) click") |
| | | print("\(device.name) click \(self.miniWindows.count)") |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | func NewMiniWindow(miniWindow:MiniWindowData) -> some View{ |
| | | MiniWindow(miniData: miniWindow) |
| | | .frame(maxWidth: .infinity,maxHeight: .infinity,alignment: .topLeading) |
| | | .onCloseClick { |
| | | guard let index = miniWindows.firstIndex(where: { $0.id == miniWindow.id }) else { return } |
| | | miniWindows.remove(at: index) |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |