Playback audio file from server in Qt GUI



  • Dear all,

    In a scenario where GUI needs to playback an audio file on user request (out of multiple audio files residing in a single folder), what is the best practice?
    The files are on a Linux system, GUI runs on both linux/windows. Both on the same network.

    I've already started a samba on server. GUI mounts the shared folder, and plays the audio files like it does with the local files. But what are the other choices?

    Thanks in advance,
    Saeed



  • Mar7aba ya sa3eed :)

    The other choices you have depends on other file system you may use in your communication with the server. You may use other different protocols (http, ftp, ...etc) and stream the file on the run, which would look fancier, where you could download parts of the files from the beginning, and play them to the user. I don't think there are other options there!

    The way you display it on your GUI is totally irrelevant and is another story. You have to distinguish between these 3 things when working on such a program:

    1- The graphical user interface the user will see (GUI)
    2- The protocol you're gonna use to transfer the file from the server (or web address) to the user's computer.
    3- The playback system you're gonna use to decode the file into Audio or whatever other stuff you wanna represent to the user.

    If you want to have a clean, object oriented program that is reusable and useful, try to separate those 3 aspects of the program using C++ classes. With this, you'll find all the "options" you're looking for.

    Regards.



  • Thanks Mar7aba

    Already have the code of Step 1 & 3, (btw, I rather into the pitfall of streaming for now, cuz have to keep coding simple and fast)

    Just was thinking 'bout step 2, which protocol do you suggest?
    what factors I should consider?
    knowing that connection between client/server is robust and already secured.

    just keep in mind that my Qt app has to run on both OSes. (n I don't bother #ifdef-ing)

    cheers,
    Saeed



  • I don't have much experience in streaming. But from the limited knowledge I'd say; for a simple internal network, I think you're fine with SMBFS, since the connection speed is really high and you don't need to stream manually.

    If you're gonna go for an internet connection then that depends on the server you're getting the data from. It's rather a complicated decision. There's not "better", but there's "what you need". But basically, such a program has to be able to connect with HTTP and FTP, both.

    If you just want to learn, I'd suggest that you go to some open-source project and contribute there, where you could see what pros are doing and how they're dealing with stuff. It's not only being able to program, but also using the correct "design pattern" that is reusable and easy to inherit. Read more about design patterns.

    Regards.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.