Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createproducer function returning nil #5

Open
satishjkoladiya opened this issue Jan 27, 2023 · 2 comments
Open

createproducer function returning nil #5

satishjkoladiya opened this issue Jan 27, 2023 · 2 comments

Comments

@satishjkoladiya
Copy link

let producer = try? sendTransport.createProducer(for: audioTrack, encodings: nil, codecOptions: nil, appData: nil)

this is returning nil. please help me to resolve this

@Mahmoud-Yousef
Copy link

use

do {
    let producer = try sendTransport.createProducer(for: audioTrack, encodings: nil, codecOptions: nil, appData: nil)
} catch {
    print(error.localizedDescription)
}

to catch the error

@fedulvtubudul
Copy link
Collaborator

There are several possible reasons. As @Mahmoud-Yousef said, we need more logs to investigate this. At least print out the error thrown by createProducer(...).

What it can be:

  1. SendTransportDelegate not implemented correctly. Make sure you've set transport delegate and implemented onProduce method. This method must talk to your media server via signaling mechanism, your server creates producer on server-side and provides you an id for created producer. onProduce method must call it's callback closure with id provided by your media server.
  2. SendTransport is in incorrect state (yet not connected or already disconnected)
  3. Working with sendTransport from arbitrary thread (all calls to mediasoupclient should be done from the same dedicated thread/queue)
  4. Using codec unsupported by your media server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants