Skip to content

Commit

Permalink
内部的に使う VideoView を UIKitVideoView に置き換える
Browse files Browse the repository at this point in the history
  • Loading branch information
zztkm committed Sep 30, 2024
1 parent 88f2007 commit 23783c6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sora/SwiftUIVideoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public struct SwiftUIVideoView<Background>: View where Background: View {
}

/*
VideoView (UIKit) を SwiftUI view に統合するためのラッパーです。
UIKitVideoView を SwiftUIVideoView に統合するためのラッパーです。
*/
private struct RepresentedVideoView: UIViewRepresentable {
typealias UIViewType = UIKitVideoView
Expand All @@ -126,21 +126,21 @@ private struct RepresentedVideoView: UIViewRepresentable {
self.controller = controller
}

public func makeUIView(context: Context) -> VideoView {
public func makeUIView(context: Context) -> UIKitVideoView {
controller.videoView
}

public func updateUIView(_ uiView: VideoView, context: Context) {
public func updateUIView(_ uiView: UIKitVideoView, context: Context) {
controller.stream?.videoRenderer = uiView
}
}

class VideoController: ObservableObject {
var stream: MediaStream?

// init() で VideoView を生成すると次のエラーが出るので、生成のタイミングを遅らせておく
// init() で UIKitVideoView を生成すると次のエラーが出るので、生成のタイミングを遅らせておく
// Failed to bind EAGLDrawable: <CAEAGLLayer: 0x********> to GL_RENDERBUFFER 1
lazy var videoView = VideoView()
lazy var videoView = UIKitVideoView()

@Published var isCleared: Bool = false

Expand Down

0 comments on commit 23783c6

Please sign in to comment.