Search code examples
javascriptyoutube-apiagora.ioagora-web-sdk-ng

How to publish to rtmp services such as youtube/facebook with agora web sdk


I have created youtube/facebook live events, account on agora and tried with agora demo on web demo:

https://webdemo.agora.io/agora-websdk-api-example-4.x/pushStreamToCDN/index.html

I am getting Unexpected_Response when I can client.startLiveStreaming(youtube_rtmp_url, false); I also tried to change client to use 'h264' codec but the same failure.

Probably I am using youtube live stream url wrong. I tried multiple combinations of rtmp url:

rtmp://a.rtmp.youtube.com/live2

rtmp://a.rtmp.youtube.com/live2/secret_stream_key

rtmp://a.rtmp.youtube.com/live2?custom_variable_name=secret_stream_key

But No success so far. Am I missing something?

Exact Error message on console: live streaming error: AgoraRTCError UNEXPECTED_RESPONSE: live streaming app center error, code: 400, reason: invalid_appid


Solution

  • I think you are facing this issue because you haven't enabled RTMP in your console. Please refer this link.

    Also make sure you are publishing to livetranscoding after the channel is joined. Use the relevant callbacks to make sure this is happening.

    NOTE: You need to add / after the main URL of rtmp.

    Example: rtmp://a.rtmp.youtube.com/live1/jmhw-rgv0-uem7-6411-195h