×

Discussion Board

Results 1 to 7 of 7
  1. #1
    archerabi
    Guest

    QtMobility QMediaplayer::SetMedia()

    Hello,
    So i have been experimenting with QMediaplayer from the QtMobility project.

    i was able to play local files just fine.
    I am trying to either provide a remote file or try providing QBuffer to SetMEdia() , but if i do that the player is stuck in the Loading state.
    The docs for the QMediaplayer::setmedia dont exist .So reading the source points to the setmedia() function in QMediaPlayercontrol.But the QMediaplayercontrol.cpp class doesnt provide the source for the setMedia function.
    SO my question is there a way to stream audio from a remote location or provide our own QIOdevice to QMediaplayer.

    Thanks.

  2. #2
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    73

    Re: QtMobility QMediaplayer::SetMedia()

    Hi
    I also tried to make streaming with QMediaplayer work. But I didn't succeed. So I cannot help you in that point. I now do it with the Phonon Framework and it works fine. So if you are not restricted to QMediaplayer, use Phonon.

    Cheers, Lukas

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    53

    Re: QtMobility QMediaplayer::SetMedia()

    Hi lukiluuk !

    Which Operating System do you use with Phonon ? Is it Symbian ?

  4. #4
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    73

    Re: QtMobility QMediaplayer::SetMedia()

    Yes, it is symbian.

  5. #5
    archerabi
    Guest

    Re: QtMobility QMediaplayer::SetMedia()

    @lukiluuk i did try using phonon before and i wasn't able to give it a QIODevice .

    Code:
    QFile file("c:\\data\\images\\123.mp3");
        file.open(QIODevice::ReadOnly);
    
        QByteArray array =file.read(512*1024);
        QBuffer* buffer = new QBuffer(&array);
        buffer->open(QIODevice::ReadOnly);
    
        mediaObject->setCurrentSource( Phonon::MediaSource(buffer));
        mediaObject->play();
    but this wasnt able to play any audio.
    Do you have any sample code that plays buffers or Streams from a URL?
    That would be very helpful.
    Thank you.

  6. #6
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    73

    Re: QtMobility QMediaplayer::SetMedia()

    You don't need to create an QIODevice. Simply open the file directly in the Mediasource constructor:

    mediaObject->setCurrentSource( Phonon::MediaSource("c:\\data\\images\\123.mp3"));

    This should work.

    Cheers

  7. #7
    Registered User
    Join Date
    Dec 2010
    Posts
    6

    Re: QtMobility QMediaplayer::SetMedia()

    Hi

    I have been trying to make an internet radio App for S60/Symbian^3 devices and I have tried various things. What I need to do is process the input stream (which basically contains mp3 data and some additional info) I parse the input string before passing the mp3 file to a QBuffer. I need to pass this QBuffer to an output device. I tried QAudioOutput in the beginning but i relaized that it supports only PCM and nothing else. QMediaPlayer can read MP3 files but we can't pass a QBuffer containing the same data and make it play it. I tried the above method but faced the same issue.

    I then tried Phonon and got it to work in the Desktop (WinXP) environment. But when I build the same application for the Symbian platform, it fails to play it. I tried passing a mp3 file as lukiluuk mentioned. It plays when we pass a .mp3 file but not when we pass a QBuffer. How do I work this out. I have searched everywhere in the net without much success.

    Plz Help

Similar Threads

  1. QVideoWidget and QMediaPlayer
    By JuanMendez in forum Qt
    Replies: 1
    Last Post: 2010-07-12, 15:10
  2. Error with QtMobility 1.0 after succesfully intall QtMobility tp2
    By Estel in forum [Archived] Qt Mobility Project
    Replies: 0
    Last Post: 2010-06-21, 21:21
  3. Replies: 8
    Last Post: 2010-01-25, 09:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×