腾讯云直播SDKV1 升级 V2 API 对比说明_音视频解决方案_同尘科技

直播SDK 2年前 (2023-07-26) 浏览 70

升级概述

为了更好地满足客户的接入需求,直播 SDK 在 API 以及支持的协议上做了重要的升级。API 2.0 相比与 API 1.0 在设计上更简洁也更实用。

TXLivePushConfig

V1 API V2 API 对应接口 备注
setHomeOrientation V2TXLivePusher.setVideoQuality 请参见V2TXLiveVideoEncoderparam.videoResolutionMode
setVideoResolution 请参见V2TXLiveVideoEncoderparam.videoResolution
setVideoFPS 请参见V2TXLiveVideoEncoderparam.videoFps
setVideoBitrate 请参见V2TXLiveVideoEncoderparam.videoBitrate
setMinVideoBitrate 请参见V2TXLiveVideoEncoderparam.minVideoBitrate
setVideoEncodeGop V2 API 去掉该接口
setAutoAdjustBitrate V2 API 去掉该接口
setAutoAdjustStrategy V2 API 去掉该接口
setMaxVideoBitrate V2 API 去掉该接口
setTouchFocus V2TXLivePusher.getDeviceManager.setCameraFocusPosition
setEnableZoom V2 API 去掉该接口
setWatermark(Bitmap watermark, int x, int y) V2TXLivePusher.setWatermark
setWatermark(Bitmap watermark, float x, float y, float width)
setPauseImg(Bitmap img) V2TXLivePusher.startVirtualCamera V2 中有关垫片推流的场景使用主要会用到以下接口:startMicrophone 打开麦克风stopMicrophone 关闭麦克风startCamera 打开本地摄像头stopCamera 关闭本地摄像头startVirtualCamera 开启图片推流stopVirtualCamera 关闭图片推流pauseAudio 暂停推流器的音频流resumeAudio 恢复推流器的音频流pauseVideo 暂停推流器的视频流resumeVideo 恢复视频推流场景1场景2场景3主播上行音视频过程中,切后台推送默认背景图,回到前台继续推摄像头数据。1. 主播上行音视频:startMicrophone + startCamera + startPush2. 主播切后台,不上行摄像头,上行主播已离开的提示图片:stopCamera + startVirtualCamera3. 主播回到前台,重新上行摄像头:stopVirtualCamera + startCamera主播以纯音频开播,可选择推送一张封面图;也可中途恢复推送摄像头数据;或者停止上行视频,只在本地预览摄像头数据。1. 主播纯音频推垫片:startMicrophone + startVirtualCamera + startPush2. 主播打开摄像头上行摄像头数据:stopVirtualCamera + startCamera3. camera 不关闭,停止上行视频:pauseVideo4. camera 不关闭,恢复上行视频:resumeVideo主播直播过程中需要调整视频画面如美颜等,短暂暂停上行视频,同时保持摄像头预览。1. 主播上行音视频:startMicrophone + startCamera + startPush2. camera 不关闭,停止上行视频:pauseVideo3. camera 不关闭,恢复上行视频:resumeVideo
setPauseImg(int time, int fps) V2 API 去掉该接口
setPauseFlag V2 API 细分了暂停音频视频推流的接口,因此去掉该接口。
setAudioSampleRate V2TXLivePusher.setAudioQuality V2TXLivePusher.setAudioQuality 接口可针对以下场景设置:1. V2TXLiveAudioQualitySpeech 采样率:16k、单声道适合在线会议,语音通话2. V2TXLiveAudioQualityDefault 采样率:48k、单声道如无特殊需求推荐3. V2TXLiveAudioQualityMusic 采样率:48k、双声道 、全频带适合需要高保真传输音乐的场景,比如K 歌、音乐直播
setAudioChannels
enableAudioEarMonitoring V2TXLivePusher.getAudioEffectManager.enableVoiceEarMonitor
enablePureAudioPush V2 API 去掉该接口
enableScreenCaptureAutoRotate V2 API 去掉该接口
enableHighResolutionCaptureMode V2 API 去掉该接口
setVideoEncoderXMirror V2 API 去掉该接口
setConnectRetryCount V2 API 去掉该接口,重连逻辑由内部自动处理
setConnectRetryInterval V2 API 去掉该接口,重连逻辑由内部自动处理
setCustomModeType 开启自定义音频采集:V2TXLivePusher.enableCustomAudioCapture开始自定义视频采集:V2TXLivePusher.enableCustomVideoCapture
enableANS V2 API 去掉该接口,由内部自动处理
enableAEC V2 API 去掉该接口,由内部自动处理
enableAGC V2 API 去掉该接口,由内部自动处理
setVolumeType V2TXLivePusher.getDeviceManager.setSystemVolumeType
setHardwareAcceleration V2 API 去掉该接口,由内部自动处理,优先使用硬编
enableVideoHardEncoderMainProfile V2 API 去掉该接口,由内部自动处理
setMetaData V2 API 去掉该接口
enableMute V2TXLivePusher.pauseAudio
setFrontCamera V2TXLivePusher.getDeviceManager.switchCamera
setBeautyFilter V2TXLivePusher.getBeautyManager.setBeautyLevelV2TXLivePusher.getBeautyManager.setWhitenessLevelV2TXLivePusher.getBeautyManager.setRuddyLevel
setEyeScaleLevel V2TXLivePusher.getBeautyManager.setEyeScaleLevel
setFaceSlimLevel V2TXLivePusher.getBeautyManager.setFaceSlimLevel
enableNearestIP V2 API 去掉该接口,由内部自动处理
setRtmpChannelType V2 API 去掉该接口,由内部自动处理
setCustomVideoPreProcessLibrary V2 API 去掉该接口
setCustomAudioPreProcessLibrary V2 API 去掉该接口

TXLivePusher

V1 API V2 API 对应接口 备注
setPushListener V2TXLivePusher.setObserver
setAudioVolumeEvaluationListener V2TXLivePusherObserver.onMicrophoneVolumeUpdate
enableAudioVolumeEvaluation V2TXLivePusher.enableVolumeEvaluation
startCameraPreview V2TXLivePusher.startCamera
stopCameraPreview V2TXLivePusher.stopCamera
startPusher V2TXLivePusher.startPush
stopPusher V2TXLivePusher.stopPush
pausePusher V2TXLivePusher.pauseAudioV2TXLivePusher.pauseVideo
resumePusher V2TXLivePusher.resumeAudioV2TXLivePusher.resumeVideo
isPushing V2TXLivePusher.isPushing
setVideoQuality V2TXLivePusher.setVideoQuality adjustBitrate 和 adjustResolution 不再支持,由内部自动处理
switchCamera V2TXLivePusher.getDeviceManager.switchCamera
frontCamera V2TXLivePusher.getDeviceManager.isFrontCamera
setMirror V2TXLivePusher.setRenderMirror
setRenderRotation V2TXLivePusher.setRenderRotation
turnOnFlashLight V2TXLivePusher.getDeviceManager.enableCameraTorch
getMaxZoom V2TXLivePusher.getDeviceManager.getCameraZoomMaxRatio
setZoom V2TXLivePusher.getDeviceManager.setCameraZoomRatio
setFocusPosition V2TXLivePusher.getDeviceManager.setCameraFocusPosition
setExposureCompensation V2TXLivePusher.getDeviceManager.setExposureCompensation
getBeautyManager V2TXLivePusher.getBeautyManager
setMute V2TXLivePusher.pauseAudio
getAudioEffectManager V2TXLivePusher.getAudioEffectManager
setVideoRecordListener V2 API 去掉该接口
startRecord V2 API 去掉该接口
stopRecord V2 API 去掉该接口
snapshot V2TXLivePusher.snapshot V2TXLivePusherObserver.onSnapshotComplete
sendCustomVideoTexture V2TXLivePusher.sendCustomVideoFrame V2TXLiveVideoFrame.pixelFormat = V2TXLivePixelFormatTexture2DV2TXLiveVideoFrame.pixelFormat.bufferType = V2TXLiveBufferTypeTexture
sendCustomVideoData V2TXLiveVideoFrame.pixelFormat.bufferType = V2TXLiveBufferTypeByteArray
sendCustomPCMData V2TXLivePusher.sendCustomAudioFrame
setVideoProcessListener V2TXLivePusher.enableCustomVideoProcess V2TXLivePusherObserver.onProcessVideoFrame
setAudioProcessListener V2TXLivePusher.enableAudioProcessObserver V2TXLivePusherObserver.onProcessAudioFrame
setSurface V2TXLivePusher.setRenderView
setSurfaceSize V2 API 去掉该接口
sendMessageEx V2TXLivePusher.sendSeiMessage
onLogRecord V2 API 去掉该接口
startScreenCapture V2TXLivePusher.startScreenCapture
stopScreenCapture V2TXLivePusher.stopScreenCapture
pauseScreenCapture V2 API 去掉该接口
resumeScreenCapture V2 API 去掉该接口
getBeautyManager V2TXLivePusher.getBeautyManager
getAudioEffectManager V2TXLivePusher.getAudioEffectManager
callExperimentalAPI V2TXLivePusher.setProperty

ITXLivePushListener

V1 API V2 API 对应接口 备注
onPushEvent V2TXLivePusherObserver.onErrorV2TXLivePusherObserver.onWarningV2TXLivePusherObserver.onPushStatusUpdate V2 对 V1 onPushEvent 回调进行了重新设计,细分为 onError、onWarning、onPushStatusUpdate 三个模块:onError中会抛出阻塞直播推流的错误信息onWarning中处理一些不会阻塞直播推流但是影响体验的警告信息onPushStatusUpdate是直播推流状态的改变信息回调
onNetStatus V2TXLivePusherObserver.onStatisticsUpdate

TXLivePlayConfig

V1 API V2 API 对应接口 备注
setCacheTime V2TXLivePlayer.setCacheParams 当正确设置 V2TXLivePlayer.setCacheParams 中 minTime 和 maxTime 时,播放器会按照预设的最小值最大值范围内自动调整
setAutoAdjustCacheTime
setMaxAutoAdjustCacheTime
setMinAutoAdjustCacheTime
setVideoBlockThreshold V2 API 去掉该接口
setConnectRetryCount V2TXLivePlayer.setProperty kV2MaxNumberOfReconnection
setConnectRetryInterval kV2SecondsBetweenReconnection
setHeaders kV2SetHeaders
enableAEC V2 API 去掉该接口,由内部自动处理
setEnableMessage V2TXLivePlayer.enableReceiveSeiMessage V2 开启接收 SEI 消息后通过 V2TXLivePlayerObserver.onReceiveSeiMessage 回调接收到 SEI 消息
setEnableMetaData V2 API 去掉该接口,默认开启
setFlvSessionKey V2 API 去掉该接口
setEnableNearestIP V2 API 去掉该接口,由内部自动处理
setRtmpChannelType V2 API 去掉该接口,由内部自动处理
setCacheFolderPath V2 API 去掉该接口
setMaxCacheItems V2 API 去掉该接口

TXLivePlayer

V1 API V2 API 对应接口 备注
setPlayListener V2TXLivePlayer.setObserver 
setAudioRawDataListener V2TXLivePlayerObserver.onPlayoutAudioFrame
setAudioVolumeEvaluationListener V2TXLivePlayerObserver.onPlayoutVolumeUpdate
enableAudioVolumeEvaluation V2TXLivePlayer.enableVolumeEvaluation
recordDelegate V2 API 去掉该接口 
isAutoPlay V2 API 去掉该接口 
setPlayerView V2TXLivePlayer.setRenderView 
setSurface 
setSurfaceSize V2 API 去掉该接口 
startPlay V2TXLivePlayer.startLivePlay 
stopPlay V2TXLivePlayer.stopPlay 
isPlaying V2TXLivePlayer.isPlaying 
pause V2TXLivePlayer.pauseAudioV2TXLivePlayer.pauseVideo 
resume V2TXLivePlayer.resumeAudioV2TXLivePlayer.resumeVideo 
setRenderRotation V2TXLivePlayer.setRenderRotation 
setRenderMode V2TXLivePlayer.setRenderFillMode 
enableHardwareDecode V2 API 去掉该接口,由内部自动处理,优先硬解 
snapshot V2TXLivePlayer.snapshot V2TXLivePlayerObserver.onSnapshotComplete
getCurrentRenderPts V2 API 去掉该接口 
setMute V2TXLivePlayer.pauseAudioV2TXLivePlayer.resumeAudio 
setVolume V2TXLivePlayer.setPlayoutVolume 
setAudioRoute V2TXLivePlayer.getDeviceManager.setAudioRoute 
prepareLiveSeek V2 API 去掉该接口 
resumeLive V2 API 去掉该接口 
seek V2 API 去掉该接口 
setAutoPlay V2 API 去掉该接口 
startRecord V2 API 去掉该接口 
stopRecord V2 API 去掉该接口 
setRate V2 API 去掉该接口 
switchStream V2TXLivePlayer.switchStream 
callExperimentalAPI V2 API 去掉该接口 

ITXLivePlayListener

V1 API V2 API 对应接口 备注
onPlayEvent V2TXLivePlayerObserver.onErrorV2TXLivePlayerObserver.onWarningV2TXLivePlayerObserver.onVideoPlayingV2TXLivePlayerObserver.onVideoLoadingV2TXLivePlayerObserver.onAudioPlayingV2TXLivePlayerObserver.onAudioLoading V2 对 V1 onPushEvent 回调进行了重新设计,细分为 onError、onWarning、onVideoPlaying、onVideoLoading、onAudioPlaying、onAudioLoading 六个模块:onError中会抛出阻塞拉流的错误信息onWarning中处理一些不会阻塞拉流但是影响体验的警告信息onAudioPlayingonAudioLoading是拉流音频状态的改变信息回调onVideoPlayingonVideoLoading是拉流视频状态的改变信息回调
onNetStatus V2TXLivePlayerObserver.onStatisticsUpdate



对音视频的解决方案有疑惑?想了解解决方案收费? 联系解决方案专家

腾讯云限时活动1折起,即将结束: 马上收藏

同尘科技为腾讯云授权服务中心,购买腾讯云享受折上折,更有现金返利:同意关联,立享优惠

阿里云解决方案也看看?: 点击对比阿里云的解决方案

- 0人点赞 -

发表点评 (0条)

not found

暂无评论,你要说点什么吗?