Page 1 of 2

mediactrl.Load always gives False

Posted: Wed Oct 09, 2019 4:54 am
by judyboon
Hi Folks, I am having some trouble in loading media files using `mediactrl.Load`. The method always return False, even the media file does exist. I also tried the demo code with `demo/data/testmovie.mpg` file, still no luck. I tried both python `2.7.14` and `3.6.5` with wxPython `4.0.6`.

I also tried to run the demo code on a different macOS version (10.14 Mojave), and it magically worked. The macOS I am running is 10.15 Catalina. Does it because the os version issue? Am I missing something like codec dependency? Any help would be appreciated.

Thanks in advance.

Re: mediactrl.Load always gives False

Posted: Wed Oct 09, 2019 2:18 pm
by ONEEYEMAN
Hi,
It is possible that with 10.15 media library was deprecated and some other API got introduced, which is incompatible with old versions.

Could you please try to compile wxWidgets C++ and then build and run media sample?

It is easy and straightforward.

If you have any trouble - post here and someone will be able to help.

Thank you.

Re: mediactrl.Load always gives False

Posted: Wed Oct 09, 2019 8:02 pm
by judyboon
Thanks for the rely :) ONEEYEMAN. I am able to successfully build/compile wxWidgets C++ library on my 10.15 macOS. How could I let my wxPython to use the newly complied library?

Re: mediactrl.Load always gives False

Posted: Thu Oct 10, 2019 1:29 am
by ONEEYEMAN
Hi,
Are yu able to compile and run media sample?
Then we will talk about using it inside wxPython...

Thank you.

Re: mediactrl.Load always gives False

Posted: Thu Oct 10, 2019 7:17 pm
by judyboon
Yes, I am able to run the mediaplayer example perfectly. The player is able to open `demo/data/testmovie.mpg` file.

Thanks,

Re: mediactrl.Load always gives False

Posted: Mon Nov 04, 2019 11:41 am
by jon.warbrick
For what it's worth I also have this problem on 10.15 Catalina, but not on 10.14 Mojava. I've yet to check what happens with the C example media player, but judyboon's experience does suggest that the problem is probably Python-related.

Re: mediactrl.Load always gives False

Posted: Mon Nov 04, 2019 1:40 pm
by jon.warbrick
Worth noting that I've opened an issue for this in wxPython's GitHub: https://github.com/wxWidgets/Phoenix/issues/1413

Re: mediactrl.Load always gives False

Posted: Tue Nov 05, 2019 7:14 pm
by jon.warbrick
Over on the wxPython GitHub issue, Robin Dunn has posted a link to a 4.1 preview build that seems to partly address this issue:

https://github.com/wxWidgets/Phoenix/is ... -549659032

However this version of the library won't play MIDI files on either 10.15 Catalina or on 10.14 Mojave (reporting the same 'Unsupported format?' error). It's unfortunatly MIDI playback from Python that I'm particularly interested in.

I've experimented with wxWidget's mediaplayer sample in both the 3.0.4 and 3.1.3 releases. There appear to be issues building 3.0.4 under Macos 10.14 and 10.15 because of the removal of stdlibc++ and to work around that I had to run ../configure with --with-macosx-version-min=10.9 when building 3.0.4. This seems to have been fixed in 3.1.3.

All 4 mediaplayers seemed to work the same - all successfully played a MPEG movie and none played a MIDI file, but I don't actually know if mediaplayer is intended to support miid playback.

I'm not sure where this gets us.

Re: mediactrl.Load always gives False

Posted: Tue Nov 05, 2019 7:52 pm
by ONEEYEMAN
Hi,
jon.warbrick wrote: Tue Nov 05, 2019 7:14 pm Over on the wxPython GitHub issue, Robin Dunn has posted a link to a 4.1 preview build that seems to partly address this issue:

https://github.com/wxWidgets/Phoenix/is ... -549659032

However this version of the library won't play MIDI files on either 10.15 Catalina or on 10.14 Mojave (reporting the same 'Unsupported format?' error). It's unfortunatly MIDI playback from Python that I'm particularly interested in.

I've experimented with wxWidget's mediaplayer sample in both the 3.0.4 and 3.1.3 releases. There appear to be issues building 3.0.4 under Macos 10.14 and 10.15 because of the removal of stdlibc++ and to work around that I had to run ../configure with --with-macosx-version-min=10.9 when building 3.0.4. This seems to have been fixed in 3.1.3.
It is better to use 10.9 as a min deployment version.
Some things are not ready for 10.14/10.15 and when it is linking against 10.9 it works better.

Also, keep in mind that Stefan himself uses 10.9.
jon.warbrick wrote: Tue Nov 05, 2019 7:14 pm All 4 mediaplayers seemed to work the same - all successfully played a MPEG movie and none played a MIDI file, but I don't actually know if mediaplayer is intended to support miid playback.

I'm not sure where this gets us.
Can you start a player in the OSX (not wxWidgets one) - I think iTunes or something, and try to play the file(s) in question?

Thank you.

Re: mediactrl.Load always gives False

Posted: Thu Nov 14, 2019 8:08 pm
by jon.warbrick
ONEEYEMAN wrote: Tue Nov 05, 2019 7:52 pm Can you start a player in the OSX (not wxWidgets one) - I think iTunes or something, and try to play the file(s) in question?
That's a good question, and one that may throw some light on what's going on.

The canonical media player in Macos is QuickTimePlayer. The version distributed with the operating system hasn't played MIDI files since QuickTimePlayer 10 was released with Macos 10.6 (SnowLeopard). However a copy of the previous QuickTimePlayer 7 remained available and it plays MIDI files including my test example on Macos 10.14 (Mojave). QuickTimePlayer 7 won't run on Macos 10.15 (Catalina), I suspect because it's a 32-bit application.

I think this is all bound up with the move from the old and long deprecated QTKit Macos media interface to the new AVFoundation one. The version of wxPython that could play MIDI files on 10.14 shipped with a copy of libwx_osx_cocoau_media v3.0.4 that includes symbols like 'wxQTMediaBackend' suggesting it was built against QTkit and was apparently built on a VM running Macos 10.10. However this version doesn't work at all on 10.15 which makes sense since QTkit has been dropped there. I have a test version of a newer wxPython that ships with libwx_osx_cocoau_media v3.1.4 containing symbols like 'wxAVMediaBackend' suggesting it was built against AVFoundation. This version works on both 10.14 and 10.15 but won't play MIDI files. Apple's documentation (see for example [1]) suggests that AVFoundation can play MIDI files, but perhaps not through the interface wxWidgets is using for everything else.

So I think the move to AVFoundation that has been happening over the last few years but which has been forced by the release of 10.15 actually broke MIDI playback on Macos. This is a bit of a minority interest, but with lots of programs having to be updated for 10.15 it's possible users other then the EasyABC music processor I'm working on will come out to the woodwork.

I'm plan to open a wxWidgets thicket for this since it's a regression, though I won't be surprised if it never gets fixed. It's too far out of my comfort zone for me to be able to help.

Jon.

[1] https://developer.apple.com/documentati ... midiplayer

Re: mediactrl.Load always gives False

Posted: Thu Nov 14, 2019 8:14 pm
by ONEEYEMAN
Hi,
You are looking at the Apple ticket - especially if their documentation says "it will play MIDI file(s)".

Thank you.

Re: mediactrl.Load always gives False

Posted: Thu Nov 14, 2019 8:34 pm
by jon.warbrick

Re: mediactrl.Load always gives False

Posted: Thu Nov 14, 2019 9:08 pm
by ONEEYEMAN
Hi,
Well, you said you tried to play MIDI file with the latest QuickTime Player and it failed.
So you should create a ticket with Apple also.

Thank you.

Re: mediactrl.Load always gives False

Posted: Thu Nov 14, 2019 9:36 pm
by New Pagodi
It looks like vlc will play midi files and that would probably be a better cross platform approach anyway.

However you need to specify a soundfont file. With the vlc binary this just requires setting an option. I cant quite figure out how to do this through the libvlc interface.

Re: mediactrl.Load always gives False

Posted: Thu Nov 14, 2019 11:26 pm
by doublemax
New Pagodi wrote: Thu Nov 14, 2019 9:36 pm However you need to specify a soundfont file. With the vlc binary this just requires setting an option. I cant quite figure out how to do this through the libvlc interface.
I haven't tried it with soundfonts, but usually you can pass the same command line options to libvlc that you can pass to the VLC exe. (In the call to libvlc_new).

https://wiki.videolan.org/VLC_command-line_help

Code: Select all

--soundfont=<string>       SoundFont file