human: 如何处理七牛云的实时音视频QNCustomVideoTrack

gpt: [实时音视频](https://developer.qiniu.com/rtc) > API 文档 > iOS >QNCustomVideoTrack

#  QNCustomVideoTrack

最近更新时间: 2023-07-07 21:17:13

本地视频自定义导入 Track 类

Hierarchy

  * [QNTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8851/QNTrack-iOS)
    * [QNLocalTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8847/QNLocalTrack-iOS)
      * [QNLocalVideoTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8849/QNLocalVideoTrack-iOS)
        * [QNCameraVideoTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8852/QNCameraVideoTrack-iOS)
        * [QNScreenVideoTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8850/QNScreenVideoTrack-iOS)
        * QNCustomVideoTrack 
      * [QNLocalAudioTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8854/QNLocalAudioTrack-iOS)
        * [QNMicrophoneAudioTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8855/QNMicrophoneAudioTrack-iOS)
        * [QNCustomAudioTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8856/QNCustomAudioTrack-iOS)
    * [QNRemoteTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8857/QNRemoteTrack-iOS)
      * [QNRemoteVideoTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8858/QNRemoteVideoTrack-iOS)
      * [QNRemoteAudioTrack](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/8859/QNRemoteAudioTrack-iOS)

Index

Core Properties

  * userID
  * trackID
  * kind
  * tag
  * muted
  * delegate

Core Methods

  * updateMute
  * destroy
  * sendSEI
  * sendSEIWithData
  * play
  * pushVideoSampleBuffer
  * pushPixelBuffer

Core Properties

userID

  * @property (nonatomic, readonly) NSString *userID;
  * 一路 Track 所属用户的唯一标识

trackID

  * @property (nonatomic, strong) NSString *trackID;
  * 一路 Track 在 Server 端的唯一标识

kind

  * @property (nonatomic, readonly) [QNTrackKind](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/9254) kind;
  * 标识该路 Track 是音频还是视频

tag

  * @property (nonatomic, strong) NSString *tag;
  * Track 的 tag

> 当发布多路视频 Track 时，可用 tag 来作区分

muted

  * @property (nonatomic, assign, readonly) BOOL muted;
  * 标识 Track 是否为 mute 状态

delegate

  * @property (nonatomic, weak) id<[QNLocalVideoTrackDelegate](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/11970/QNLocalVideoTrackDelegate)> delegate;
  * 视频 Track 回调代理

Core Methods

updateMute

  * \- (void)updateMute:(BOOL)mute;
  * 更新当前 Track 的 mute 值，静默后，SDK 将会发送静默帧数据

当静默状态改变后，远端用户将会收到
[QNRemoteVideoTrackDelegate.didMuteStateChanged](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-
iOS/11947) 的回调

Parameters

    * mute: BOOL 

是否静默 Track

destroy

  * \- (void)destroy;
  * 销毁本地音/视频 Track

> 在不使用该 Track 之后，请务必调用此接口

sendSEI

  * \- (void)sendSEI:(NSString *)videoSEI uuid:(NSString *)uuid repeatNmuber:(NSNumber *)repeatNumber;
  * 发送 SEI

> 该接口已废弃，请使用
> [QNLocalVideoTrack.sendSEIWithData](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-
> iOS/8849)

> 需要停止发送 SEI，可以设置 videoSEI 为 nil，repeatNumber 为 0 即可

Parameters

    * videoSEI: NSString 

SEI 的消息内容

    * uuid: NSString 

设备 UUID

    * repeatNumber: NSNumber 

重复次数

sendSEIWithData

  * \- (void)sendSEIWithData:(NSData *)SEIData uuid:(NSData *)uuid repeatCount:(NSNumber *)repeatCount;
  * 发送 SEI

> SEIData SEI 内容，不超过 4096 个字节
>
> 需要停止发送 SEI，可以设置 SEIData 为 nil，repeatCount 为 0 即可

Parameters

    * SEIData: NSString 

SEI 的消息内容

    * uuid: NSString 

设备 UUID

    * repeatCount: NSNumber 

重复次数

play

  * \- (void)play:([QNVideoGLView](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/11950/QNVideoGLView-iOS) *)videoView;
  * 视频 Track 渲染

Parameters

    * videoView: [QNVideoGLView](https://developer.qiniu.com/rtc/8853/QNCustomVideoTrack-iOS/11950/QNVideoGLView-iOS)

渲染的 view

pushVideoSampleBuffer

  * \- (void)pushVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer;
  * 导入视频数据

> 支持导入的视频数据格式为：kCVPixelFormatType_420YpCbCr8BiPlanarFullRange 和
> kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange

Parameters

    * sampleBuffer: CMSampleBufferRef 

CMSampleBufferRef 格式的视频数据

pushPixelBuffer

  * \- (void)pushPixelBuffer:(CVPixelBufferRef)pixelBuffer;
  * 导入视频数据

> 支持导入的视频数据格式为：kCVPixelFormatType_420YpCbCr8BiPlanarFullRange 和
> kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange

Parameters

    * pixelBuffer: CVPixelBufferRef 

CVPixelBufferRef 格式的视频数据

以上内容是否对您有帮助？