Results 1 to 6 of 6

Thread: About load source with phonon!

  1. #1
    Join Date
    Dec 2011
    Posts
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Question About load source with phonon!

    I had played media from file with phonon. But now, i want play media from byte buffer to inc speed of my program. But i can't find any document show about that. Plz show me how i can play media from byte buffer with phonon.

    Thanks all your help!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: About load source with phonon!

    Seems like this would be the basic process:
    • Load data into a QByteArray if you don't already have the data in a char buffer.
    • Create a QBuffer, which is a QIODevice, from the QByteArray or char buffer
    • Create a MediaSource from the QBuffer

  3. #3
    Join Date
    Dec 2011
    Posts
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: About load source with phonon!

    Thanks Chirs!

    I will try your way!

  4. #4
    Join Date
    Dec 2011
    Posts
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: About load source with phonon!

    i had write code as:

    Qt Code:
    1. QFile fileInfo(urlPath);
    2. fileInfo.open(QFile::ReadOnly);
    3. QByteArray baDuLieu = fileInfo.readAll();
    4. qDebug() << baDuLieu.count();
    5. bufDuLieu.setData(baDuLieu);
    6. qDebug() << bufDuLieu.size();
    7. // bufDuLieu.open(QIODevice::ReadOnly);
    8. Phonon::MediaSource msDL(&bufDuLieu);
    9. _mediaObject = Phonon::createPlayer(Phonon::MusicCategory, msDL);
    To copy to clipboard, switch view to plain text mode 

    but my music can't play
    It warning:
    Qt Code:
    1. MediaSource::Stream not yet handled
    To copy to clipboard, switch view to plain text mode 

    plz help !

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: About load source with phonon!

    From the MediaSource::MediaSource() docs:
    Warning: On Windows, we only support QIODevices containing the avi, mp3, or mpg formats. Use the constructor that takes a file name to open files (the Qt backend does not use a QFile internally).

  6. #6
    Join Date
    Dec 2011
    Posts
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: About load source with phonon!

    I had urlPath is one file .mp3. And I program on Symbian not Windows

Similar Threads

  1. Phonon endless stream - any phonon expert out there?
    By derektmm in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2011, 17:11
  2. Phonon - custom sink/source/effects
    By lclemens@gmail.com in forum Qt Programming
    Replies: 0
    Last Post: 18th August 2011, 02:57
  3. Replies: 1
    Last Post: 1st September 2010, 11:23
  4. Replies: 11
    Last Post: 24th March 2006, 07:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.