×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    27

    Packaging a sound effect in the application resources for use with QMediaPlayer

    Hello,

    I'm writing an application for N9 that needs to play a sound saved as a .wav file, using QMediaPlayer. I thought I'd add the sound file to the application resources for easy packaging, but when I do that, the application crashes when the sound is attempted to be played (no sound is heard). If the file is saved in a directory and referenced to as a local file, everything works.

    That is, if I use

    m_player->setMedia(QUrl("qrc:/airhorn.wav"));

    I get the segfault, whereas using

    m_player->setMedia(QUrl::fromLocalFile("/home/developer/airhorn.wav"));

    I don't. I couldn't find anything useful with the debugger.

    Has anybody experienced similar problems? Should the resource-based approach work at all?

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Packaging a sound effect in the application resources for use with QMediaPlayer

    Hi,
    Correct, QMediaPlayer cannot play any file stored in the Qt resource system.
    It doesn't work because QMedaiPlayer internally makes use of GStreamer Multimedia Framework [1], which cannot handle/fetch data from QRC files.

    [1] http://gstreamer.freedesktop.org/

Similar Threads

  1. QMediaPlayer: Only Sound but No Video
    By kcowjj in forum [Archived] Qt Mobility Project
    Replies: 5
    Last Post: 2011-11-29, 11:04
  2. QT Simulator / MacOS / QMediaPlayer - no sound
    By pzearfoss in forum [Archived] Qt SDKs and Tools
    Replies: 0
    Last Post: 2010-09-20, 15:48
  3. Touch sound effect and vibration
    By skyjun in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-05-08, 07:24
  4. Sound effect docs/examples
    By neilcoxhead in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2003-10-08, 12:30
  5. Help needed for sound effect in samsung c100 (Sorry , i got nowhere to post my qsn)
    By chinali66 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2003-08-28, 09:49

Posting Permissions

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