Skip to content

Conversation

@zztkm
Copy link
Contributor

@zztkm zztkm commented Sep 25, 2024

以前の PR の再実装: #140

@zztkm zztkm force-pushed the feature/swiftui-view branch from eee7400 to f1776d9 Compare October 1, 2024 06:26
Comment on lines +185 to +197
class VideoController: ObservableObject {
var stream: MediaStream?

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

@Published var isCleared: Bool = false

init(stream: MediaStream?) {
self.stream = stream
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwiftUIVideoView の内部状態を変えたいユーザーのための VideoController.

こいつはユーザーの View 内で利用することを想定してるので、状態変更用のメソッドを実装して提供してあげる必要がある(というのを以前実装したときは理解できてなかった。

状態変更のロジックは VideoController に寄せると View の実装がシンプルになって良さそう。

@zztkm
Copy link
Contributor Author

zztkm commented Nov 18, 2025

別のブランチで対応を進めるためクローズします。

@zztkm zztkm closed this Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants