Results 1 to 2 of 2

Thread: QMediaPlayer Questions

  1. #1
    Join Date
    Aug 2013
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question QMediaPlayer Questions

    I am tidying up some old code that used QSound which does not work on Linux (well as least mine it doesn't). Options->sounds sets the sound file to be played for various events, so that different ones can be used for different events, or muted by a checkbox. The code compiles with no errors and runs. The sounds for events work for a while and then they stop. I haven't been through all the code to see where the functions are called from, but when the test in the options->sound is used, they play, they play for a while when using the program and then stop. The following is my code:

    Qt Code:
    1. m_pPlayer = new QMediaPlayer(this);
    2. connect(m_pPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    3. m_pPlayer->setMedia(QUrl::fromLocalFile(filename));
    4. //Set the volume
    5. m_pPlayer->setVolume(100);
    6. m_pPlayer->play();
    7. disconnect(m_pPlayer, SIGNAL(triggered(bool)), this, SLOT(play()));
    8. // QSound::play(filename); not needed anymore as not using QSound
    To copy to clipboard, switch view to plain text mode 

    My questions are (remember I be an apprentice to c++ and Qt):
    1. is this code correct for the using this/these functions?
    2. where do I start looking for the problem (any ideas would be greatfully appreciated)?

  2. #2
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QMediaPlayer Questions

    I think yes, you're code seems to be correct. By the way, do you know how to play movie with image raw data with QMediaPlayer? I still cannot find a solution to my problem. Please have a look at my pre-posted post here: http://www.qtcentre.org/threads/5582...o-QMediaPlayer

Similar Threads

  1. set raw data buffer to QMediaPlayer
    By saman_artorious in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2013, 09:13
  2. QMediaplayer setposition is wrong
    By oldkkk2008 in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2013, 10:58
  3. QMediaPlayer problems
    By alenn.masic in forum Qt Programming
    Replies: 1
    Last Post: 25th February 2013, 15:32
  4. QMediaPlayer seeking in stream
    By n1ghtly in forum Qt Programming
    Replies: 0
    Last Post: 24th August 2012, 13:28
  5. videoplayer problem in qmediaplayer
    By vinayaka in forum Newbie
    Replies: 3
    Last Post: 25th August 2011, 12:44

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.