播流

在观众观看直播或者与他人视频互动中,通过播流(拉流)功能获取主播或者他人的视频画面。

步骤

1、 流信息回调

当房间内有人进入或离开时,会回调接口IRoomStreamCallback的如下方法:

onPlayStreamInfosUpdate()
2、开始播流

调用函数playStream。

this->playStream(streamID.c_str(), g_pWndVideo[j].GetSafeHwnd());
3、得到流的原始宽高

通过playStream(),会回调到ILiveRoomPlayStreamCallback::onPlayStreamVideoSizeChanged(const char* streamID, int width, int height),在此函数处理混流前的相关操作,混流需要流的原始宽高。

void AVSignalEngine::onPlayStreamVideoSizeChanged(const char* streamID, int width, int height) 
{
    //...
}
4、停止播流

调用函数stopPlayStream(const char* streamID)。

this->stopPlayStream(otherPubStreamInfo.c_str());