AVCaptureMultipeerVideoDataOutput 0.0.1

AVCaptureMultipeerVideoDataOutput 0.0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2014年12月

PJ Gray 维护。



  • PJ Gray

通过多用户连接发送一路视频流。

使用 SGSMultipeerVideoMixer 查看示例。

详细信息

将多用户连接相关内容抽象在 AVCaptureVideoDataOutput 子类内部,因此使用正常的 AV 管道设置起来很容易

    // Create the AVCaptureSession
    self.captureSession = [[AVCaptureSession alloc] init];

    // Setup the preview view
    AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.captureSession];
    captureVideoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    captureVideoPreviewLayer.frame = CGRectMake(0,0, 320, 320);
    [self.previewView.layer addSublayer:captureVideoPreviewLayer];

    // Create video device input
    AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    AVCaptureDeviceInput *videoDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:nil];
    [self.captureSession addInput:videoDeviceInput];

    // Create output
    AVCaptureMultipeerVideoDataOutput *multipeerVideoOutput = [[AVCaptureMultipeerVideoDataOutput alloc] initWithDisplayName:[[UIDevice currentDevice] name]];
    [self.captureSession addOutput:multipeerVideoOutput];

    [self.captureSession startRunning];

就这样!查看 AVCaptureMultipeerVideoDataOutput 类以了解其发送数据的详细信息。(发送的数据最终是一个相当低质量的 JPEG)。

设置

使用 cocoapods,因此只需将其添加到您的 Podfile 中

pod "AVCaptureMultipeerVideoDataOutput"

查看示例项目以获取实现示例。要运行示例

pod install

然后打开 'MultipeerVideoOutputSample.xcworkspace'

待办事项

  • 公开更多输出格式变量

联系方式

PJ Gray

许可证

AVCaptureMultipeerVideoDataOutput 可在 MIT 许可证下获得。有关更多信息,请参阅 LICENSE 文件。