aitjcize / PyTox

Python binding for Project-Tox the skype replacement.
GNU General Public License v3.0
96 stars 29 forks source link

AV with new API #56

Closed rodolpheh closed 8 years ago

rodolpheh commented 8 years ago

I'd really like to use the PyTox wrapper as my knowledge in C is limited but I see that you have recently switched to the new toxcore API so the examples are not good anymore. I was able to generate the documentation and play with some stuff but I'm not able to set up an audio transmission. Before the toxcore new API, you were using "prepare_transmission". This function does not exist anymore. Is there a new way to prepare and set up the transmission ? Do you have a working example ?

kitech commented 8 years ago

did you look at examples/echo.py or phone.py? the audio/video both work's find with new API.

rodolpheh commented 8 years ago

I did started by trying the examples. But, I had a few problems :

Since I don't need the video, I removed everything related to it and tried again. As expected, connection, messages and such are working. I can start an audio call but no sound is transmitted. I see that in the function "audio_encode", it should print "Starting audio encode thread..." but I don't have any of these messages. The same if I add a print in the callback "on_audio_data". I had a look at the sources and it seems that there is no more "prepare_transmission" nor "hangup" and some others that used to be there before the switch to the new API.

Am I missing something ? Does someone else tried the examples lastly ?

Anyway, good to see a fast answer and a commit done this morning, that means that the project is still alive :)

rodolpheh commented 8 years ago

Sorry for bothering. I just tried again the echo.py example and it seems to be able to send and receive audio/video. I will take this one as a base for my program. I will return to you if any misunderstanding and will close the issue soon. Just a side note, in the given examples, it's written :

if len(sys.argv) == 2:
    DATA = sys.argv[1]
    if exists(DATA):

Where it should be :

if len(sys.argv) == 2:
    DATA = sys.argv[1]
if exists(DATA):

The first way allow to load a file only if it was given as an argument. The second way allow to load a default file (defined by DATA) if no argument is given.

kitech commented 8 years ago

Oh, the indent... i remember the python-opencv need python2, so echo.py/phone.py also need python2.

rodolpheh commented 8 years ago

Ok I succeeded in creating an audio communication, starting with the echo.py example. Starting with the phone.py example was a bad idea as it is outdated. Thank you for your help.