addInjectStreamUrl()成功,但audience加入后看不到任何画面!win10平台

void AgoraRtcEngineEvent::onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed)
{
int ret=0;
printf(“user:%d join %s success! cost=%d ms\n”, uid, channel, elapsed);

#if 1
InjectStreamConfig config;
config.width = 0;
config.height = 0;
config.videoGop = 40;
config.videoFramerate = 20;
config.videoBitrate = 500;
config.audioSampleRate = AUDIO_SAMPLE_RATE_48000;
config.audioChannels = 1;
config.audioBitrate = 48000;
ret=m_rtcEngine->addInjectStreamUrl(gAppInjectRtmpUrl, config);
if (ret<0){
printf(“Failed to add inject stream-url:%s ,ret=%d\n”,gAppInjectRtmpUrl,ret);
}
#endif

}

int main(int argc, char **argv)
{
int ret=0;

//std::unique_ptr<agora::rtc::IRtcEngineEventHandler> m_eventHandler;
//std::mutex    m_mutex;
agora::rtc::RtcEngineContext context;

m_rtcEngine = createAgoraRtcEngine();
if (!m_rtcEngine){
	printf("Failed to createAgoraRtcEngine!\n");
	return -1;
}
printf("step1 done.\n");	

AgoraRtcEngineEvent eventHandler;
context.appId = gAppId;
context.context = 0;
context.areaCode = AREA_CODE_GLOB;
context.eventHandler = &eventHandler;
ret=m_rtcEngine->initialize(context);
if (ret<0){
	printf("Failed to Init AgoraSDK! ret=%d\n",ret);
	return -2;
}
printf("step2 done.\n");

ret=m_rtcEngine->setLogFile("AgoraSDK.log");

ret=m_rtcEngine->disableVideo();
if (ret<0){
	printf("Failed to disable video,ret=%d\n",ret);
	return -3;
}
printf("step3 done.\n");	

ret = m_rtcEngine->muteLocalAudioStream(true);
ret = m_rtcEngine->disableAudio();	//deprated??
if (ret<0){
	printf("Failed to mute audio,ret=%d\n",ret);
	return -4;
}
printf("step4 done.\n");

ret = m_rtcEngine->enableWebSdkInteroperability(true);	//deprated??
if (ret<0){
	printf("Failed to enableWebSdkInteroperability,ret=%d\n",ret);
	return -5;
}
printf("step5 done.\n");

ret=m_rtcEngine->setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING);
if (ret<0){
	printf("Failed to setChannelProfile,ret=%d\n",ret);
	return -6;
}
printf("step6 done.\n");

ret=m_rtcEngine->setClientRole(CLIENT_ROLE_BROADCASTER);
if (ret<0){
	printf("Failed to setClientRole,ret=%d\n",ret);
	return -7;
}
printf("step7 done.\n");

ret = m_rtcEngine->joinChannel(gAppToken, gAppChannelId, nullptr, gAppUserID);
if (ret<0){
	printf("Failed to join channel:%s ,ret=%d\n",gAppChannelId,ret);
	return -8;
}
printf("step8 done.\n");

printf("Enter: q to exit!\n");
char ch='\0';
while(ch != 'q'){
	scanf_s("%c",&ch,1);

	Sleep(2000);
}

return 0;

}

上面是我的code。win10工程,SDK是3.2.1。我是参考example\openlive来写的。
可以编译成功,各个step打印都是正确的,返回ret=0。但就是无法观看到流画面过来,画面是黑的,什么也没有。

该方法通过在服务端拉取视频流并发送到频道中,将正在播出的视频输入到正在进行的直播中
这条流上有画面吗? 还有就是要看下调用该方法前,确保已开通旁路推流的功能,详见进阶功能《推流到 CDN》中的前提条件

用于注入的流有画面。后台有开通旁路推流功能。

我怀疑是不是windowsNativeSDK3.2.1不支持此功能呢?据说WebSDK 4.2.1是支持注入流的。但我不懂web开发。

void AgoraRtcEngineEvent::onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed)
{
int ret=0;
printf(“user:%d join %s success! cost=%d ms\n”, uid, channel, elapsed);

#if 1
InjectStreamConfig config;
config.width = 0;
config.height = 0;
config.videoGop = 40;
config.videoFramerate = 20;
config.videoBitrate = 500;
config.audioSampleRate = AUDIO_SAMPLE_RATE_48000;
config.audioChannels = 1;
config.audioBitrate = 48000;
ret=m_rtcEngine->addInjectStreamUrl(gAppInjectRtmpUrl, config);
if (ret<0){
printf(“Failed to add inject stream-url:%s ,ret=%d\n”,gAppInjectRtmpUrl,ret);
}
#endif

}

int main(int argc, char **argv)
{
int ret=0;

//std::unique_ptr<agora::rtc::IRtcEngineEventHandler> m_eventHandler;
//std::mutex    m_mutex;
agora::rtc::RtcEngineContext context;

m_rtcEngine = createAgoraRtcEngine();
if (!m_rtcEngine){
	printf("Failed to createAgoraRtcEngine!\n");
	return -1;
}
printf("step1 done.\n");	

AgoraRtcEngineEvent eventHandler;
context.appId = gAppId;
context.context = 0;
context.areaCode = AREA_CODE_GLOB;
context.eventHandler = &eventHandler;
ret=m_rtcEngine->initialize(context);
if (ret<0){
	printf("Failed to Init AgoraSDK! ret=%d\n",ret);
	return -2;
}
printf("step2 done.\n");

ret=m_rtcEngine->setLogFile("AgoraSDK.log");

ret=m_rtcEngine->disableVideo();
if (ret<0){
	printf("Failed to disable video,ret=%d\n",ret);
	return -3;
}
printf("step3 done.\n");	

ret = m_rtcEngine->muteLocalAudioStream(true);
ret = m_rtcEngine->disableAudio();	//deprated??
if (ret<0){
	printf("Failed to mute audio,ret=%d\n",ret);
	return -4;
}
printf("step4 done.\n");

ret = m_rtcEngine->enableWebSdkInteroperability(true);	//deprated??
if (ret<0){
	printf("Failed to enableWebSdkInteroperability,ret=%d\n",ret);
	return -5;
}
printf("step5 done.\n");

ret=m_rtcEngine->setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING);
if (ret<0){
	printf("Failed to setChannelProfile,ret=%d\n",ret);
	return -6;
}
printf("step6 done.\n");

ret=m_rtcEngine->setClientRole(CLIENT_ROLE_BROADCASTER);
if (ret<0){
	printf("Failed to setClientRole,ret=%d\n",ret);
	return -7;
}
printf("step7 done.\n");

ret = m_rtcEngine->joinChannel(gAppToken, gAppChannelId, nullptr, gAppUserID);
if (ret<0){
	printf("Failed to join channel:%s ,ret=%d\n",gAppChannelId,ret);
	return -8;
}
printf("step8 done.\n");

printf("Enter: q to exit!\n");
char ch='\0';
while(ch != 'q'){
	scanf_s("%c",&ch,1);

	Sleep(2000);
}

return 0;

}

都有相关功能的,频道号是多少

static const char* gAppId=“c22ebba67fcb4dcc811a46d2e12ffe4a”;
static const char* gAppToken=“006c22ebba67fcb4dcc811a46d2e12ffe4aIABnSTRn8nfAi4rvtuebzeuaP51Hf9VeQ+r5zoR7nCg0sZ3DbR8AAAAAEABI+NBcHmUJYAEAAQAfZQlg”;
//static const char* gAppId=“04ef436e34ef4a488089da171587e50e”;
//static const char* gAppToken="";
static const char* gAppChannelId=“injection001”;
static const char* gAppInjectRtmpUrl=“rtmp://eu.wllaws.com/live/7-21”;
static const int gAppUserID=3000;
static IRtcEngine* m_rtcEngine=NULL;

频道号:injection001

我看应该是版本的问题。Agora_Native_SDK_for_Windows_v3_2_1_FULL.zip版本落后WebSDK AgoraRTC-N-4.2.1.js
WebSDK支持InjectStreamUrl,而NativeSDK不支持。

https://docs.agora.io/cn/Interactive%20Broadcast/inject_stream_windows?platform=Windows
windows可用的