josephlim94 / python_janus_client

Python Janus WebRTC client
MIT License
28 stars 5 forks source link

Unable to join room as publisher #2

Open PerryDP opened 1 month ago

PerryDP commented 1 month ago

First of all, thank you to the author for their contribution I just encountered an issue using this library I use plugin. coin (room_id=1111, Publisher_id=23456, display_name="test publish") If the room was successfully added, but did not join as a publisher Print request details 10: 50:23: Send: {"janus": "message", "body": {"request": "join", "ptype": "publisher", "room": 1111, "display": "test publish", "publisher_id": 23456}, "transaction": "49cdf138a15749e98d2e0d9d30d2d4f0", "apisecret": "wetalk_janus", "session _id": 932189969595 30429, "handle_id": 5916266656752316} Data returned by Janus server

10: 50:23: Received: {'janus': 'ack', 'session id': 932189969530429, 'transaction': '49cdf138a15749e98d2e0d9d30d2d4f0'}
10: 50:23: Received: {'janus': 'event', 'session id': 932189969530429, 'transaction': '49cdf138a15749e98d2e0d9d30d2d4f0', 'sender': 5916266656752316, 'plugindata': {'plugin ':' janus. plugin. videoroom ',' data ': {'videoroom': 'joined', 'room': 1111, 'description': 'Demo Room' ',' id ': 2664505253809310,' private_id ': 582534088,' publishers': []}}

It can be seen that the requested data is correct, but the publisher parameter and publisher_id parameter are not effective The Janus server does not have any special settings for this room. I tried using other clients to create publishers normally. I don't understand where the problem lies The second question, As a publisher, Is await publish waiting for the stream to be sent? If so, is there any other fully asynchronous method for sending streams that can stop or switch streams at any time without waiting for all streams to be sent The above is from automatic translation. We apologize for any inconvenience caused Thank you to the author for answering

josephlim94 commented 1 month ago

Hi, after joining the room (await plugin.join()) you will need to publish (await plugin.publish()) to start sending media. What do you mean the publisher parameter is not effective?

For second question, no it doesn't need to send until finish. The MediaPlayer class uses FFmpeg so "file names" supported by FFmpeg can be used. You can refer to the docstring on MediaPlayer class. In short, the webrtc implementation "takes" media frames from the media player and sends it. It will take until there is no more, or when you stop giving, or when the MediaPlayer.stop() is called.

You can also refer to test.BaseTestClass.TestClass.test_publish_and_unpublish on video room plugin usage.

You're very welcome.