Hi everyone.
I’ve already done a previous post about using WxPython+media, but I still have the same core problem, even though its nature is different.
I’ve tried adding the interfaces that would allow the application to play sound, but even after trying for hours, it still does not play sound. I’ve checked, and the sound seems to play fine from the point of view of the application.
I’ll repost the mini-example I made last time:
Code:
#!/usr/bin/env python
import wx
import wx.media
import os.path
class MyApp(wx.Frame):
def __init__(self):
path = os.path.expanduser("~/Downloads/testfile.webm")
super(MyApp, self).__init__(None, title="Test application")
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
self.panel = wx.Panel(self,size=(800, 440))
self.panel.Layout()
self.media = wx.media.MediaCtrl(self.panel, size=(800, 440))
self.media.Bind(wx.media.EVT_MEDIA_LOADED, lambda _: self.media.Play())
self.media.Bind(wx.media.EVT_MEDIA_FINISHED, lambda _: self.Destroy())
self.media.Load(path)
self.SetMinSize((800, 470))
self.SetMaxSize((800, 470))
self.Show()
Snapcraft.yaml:
snap/
--- gui/
------ my-app.desktop
------ logo.png
src/
--- my-app.py
setup.py
snapcraft.yaml
Snapcraft:
grade: stable
confinement: strict
base: core18
apps:
my-app:
command: python3 $SNAP/src/my-app.py
extensions: [gnome-3-28]
plugs:
- home
- media-control
- audio-playback
- pulseaudio
environment:
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:/snap/my-app/current/usr/lib/x86_64-linux-gnu/pulseaudio
parts:
source-copy:
plugin: dump
source: .
my-app:
plugin: python
python-version: python3
source: .
stage-packages:
- libssl-dev
- libjpeg-dev
- libtiff-dev
- libsdl1.2-dev
- libnotify-dev
- freeglut3
- ibus-gtk3
- libwebkitgtk-3.0-0
- zlib1g
- libsm6
- libpulse0
- libslang2
- libsdl1.2debian
- python3-wxgtk4.0
- python3-wxgtk-media4.0
- libgstreamer1.0-0
- libgstreamer-plugins-base1.0-0
I apologize for asking two similar questions in such a small amount of time, and thanks to anyone who wasted their time reading this post.