add onInitReady callback to send initialization segment path
This commit is contained in:
parent
a2ce4df663
commit
0a43d7a160
@ -62,6 +62,7 @@ public final class CameraView: UIView, CameraSessionDelegate {
|
||||
@objc var onStarted: RCTDirectEventBlock?
|
||||
@objc var onStopped: RCTDirectEventBlock?
|
||||
@objc var onViewReady: RCTDirectEventBlock?
|
||||
@objc var onInitReady: RCTDirectEventBlock?
|
||||
@objc var onVideoChunkReady: RCTDirectEventBlock?
|
||||
@objc var onCodeScanned: RCTDirectEventBlock?
|
||||
// zoom
|
||||
@ -340,14 +341,15 @@ public final class CameraView: UIView, CameraSessionDelegate {
|
||||
func onVideoChunkReady(chunk: ChunkedRecorder.Chunk) {
|
||||
ReactLogger.log(level: .info, message: "Chunk ready: \(chunk)")
|
||||
|
||||
guard let onVideoChunkReady = onVideoChunkReady else {
|
||||
guard let onVideoChunkReady, let onInitReady else {
|
||||
return
|
||||
}
|
||||
|
||||
switch chunk.type {
|
||||
case .initialization:
|
||||
// FIXME: send initialization segment
|
||||
return
|
||||
onInitReady([
|
||||
"filepath": chunk.url.path,
|
||||
])
|
||||
case .data(index: let index):
|
||||
onVideoChunkReady([
|
||||
"filepath": chunk.url.path,
|
||||
|
@ -55,6 +55,7 @@ RCT_EXPORT_VIEW_PROPERTY(onInitialized, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onStarted, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onStopped, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onViewReady, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onInitReady, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onVideoChunkReady, RCTDirectEventBlock);
|
||||
// Code Scanner
|
||||
RCT_EXPORT_VIEW_PROPERTY(codeScannerOptions, NSDictionary);
|
||||
|
Loading…
Reference in New Issue
Block a user