为什么80%的码农都做不了架构师?>>>
Ubuntu 14.04,Qt 5.6.0 Qt Creator 3.6.1,QML中使用Audio { id: playSound0} 播放MP3时,无法播放,console中收到如下错误:
Warning: "No decoder available for type 'audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)2, layer=(int)3, rate=(int)16000, channels=(int)1, parsed=(boolean)true'."
Error: "Your GStreamer installation is missing a plug-in."
安装一下软件包解决:
sudo add-apt-repository ppa:mc3man/gstffmpeg-keep
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-plugins-ugly
Ubuntu 16.04 中运行程序,会依次出现如下错误提示:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
GStreamer; Unable to pause - "http://media.shanbay.com/audio/us/finished.mp3"
Error: "No URI handler implemented for \"http\"."
Your GStreamer installation is missing a plug-in
sudo apt-get install gstreamer0.10-plugins-ugly 这个安装包提示错误无法安装,安装gstreamer1.0包,问题依旧,无法播放声音
$ sudo apt-get install gstreamer0.10-plugins-ugly
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package gstreamer0.10-plugins-ugly is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'gstreamer0.10-plugins-ugly' has no installation candidate
备注:
I tried digging a little into this and according to this thread in the Qt forums the issue seems to be that the QtMultimedia module is still using GStreamer 0.10 as a backend - and from that it needs the gstreamer-0.10-ffmpeg plugin which is not available in some distros anymore due to the move to libav.
If you're using a flavour of Ubuntu you can try installing gstreamer-0.10-ffmpeg from Doug McMahon's ppa:
资料来源:http://stackoverflow.com/questions/26099139/how-to-fix-gstreamer-error-in-qt5
https://forum.qt.io/topic/43468/solved-qtmultimedia-media-player-example-can-t-play-any-video-on-ubuntu-14-04