Failed to use YouTube RTMP URL and corresponding stream key on my project, but it works on the example #1585
-
Below is my code. I am sure that the RTMP URL and stream key are valid, but I actually do not know why it always returns "[RTMPConnection.Error.requestFailed]" for me. I have used the same RTMP URL and stream key on the example project, and it works there. So, I want to know why it returns the request failed error when I'm trying to use the library in my own project. Task {
guard let conn = netLiveStreamer.conn as? RTMPConnection, let stream = netLiveStreamer.stream as? RTMPStream else { return }
print("[exist]")
do {
try await conn.connect("rtmp://a.rtmp.youtube.com/live2")
try await stream.publish("xxxx-xxxx-xxxx-xxxx-xxxx")
} catch RTMPConnection.Error.requestFailed(let response) {
print("[ RTMPConnection.Error.requestFailed]")
print(response)
} catch RTMPStream.Error.requestFailed(let response) {
print("[ RTMPStream.Error.requestFailed]")
print(response)
} catch {
print("[error]")
print(error)
}
} Logs as below
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I believe it’s fixed in the main branch. Which commit hash are you using? |
Beta Was this translation helpful? Give feedback.
-
In the middle of the night, I pulled the latest update commit 03a736d and used the same set of rtmpURL and streamKey, but it doesn't work again. The log is as follows:
|
Beta Was this translation helpful? Give feedback.
I have confirmed that streaming to YouTube is working. Version 2.0.0-rc.0 has been released. It is available via CocoaPods, so please check it out.