How do I trap an invalid object error
Posted
#1
(In Topic #1424)
Regular

Code (gambas)
Posted
Guru

When you call Wait the event loop runs and closes the window making the objects invalid in the next bit of code.
try not using Wait
Posted
Regular

BruceSteers said
It's the use of Wait.
When you call Wait the event loop runs and closes the window making the objects invalid in the next bit of code.
try not using Wait
Ah. Damn. Wait is how I am getting if the value boxes are different essentially telling me if mediaview is paused or playing. Thanks Bruce. Looks like I need to come up with something different.
Posted
Guru

Code (gambas)
Posted
Guru

from here comp/src/gb.media.form/.src · master · Gambas / gambas · GitLab
download these 3 files
FMediaPlayer.form
FMediaPlayer.class
MediaView.class
then you will have…
- the latest MediaView regardless of the gambas version.
- the MediaView source code in your own project you can tweak to your hearts content

Posted
Regular

BruceSteers said
Or just remove gb.media.form component from the project properties and add the later version source to your projects .src folder
from here comp/src/gb.media.form/.src · master · Gambas / gambas · GitLab
download these 3 files
FmediaPlayer.form
FMediaPlayer.class
MediaView.class
then you will have…
- the latest MediaView regardless of the gambas version.
- the MediaView source code in your own project you can tweak to your hearts content
I think I'll try this. Thanks Bruce!
Posted
Regular

BruceSteers said
Or just remove gb.form.media from the project properties and add the later version to your projects .src folder
from here comp/src/gb.media.form/.src · master · Gambas / gambas · GitLab
download these 3 files
FmediaPlayer.form
FMediaPlayer.class
MediaView.class
then you will have…
- the latest MediaView regardless of the gambas version.
- the MediaView source code in your own project you can tweak to your hearts content
Hey Bruce, before I get ahead of myself….the mediaview1.state is what I'm looking for, right? That basically tells me if mediaview is playing, paused or stopped? Just want to make sure I'm headed in the right direction.
Posted
Guru

MediaView.State will show a value that corresponds to Media.Playing , Media.Paused , Media.Stopped etc.
Posted
Regular

BruceSteers said
Yes, MediaView.State did not exist until i requested it a couple of years ago when i made the MPRIS stuff.
MediaView.State will show a value that corresponds to Media.Playing , Media.Paused , Media.Stopped etc.
Thanks Bruce!
Posted
Regular

Posted
Regular

rj71 said
Hey Bruce, I tried your timer code in my current project but sometimes it works and sometimes it doesn't. This form has the given video start at form open, your code sometimes takes 10-15 seconds before it tells me the mediaview is playing. I'll try to figure out why. As for your other suggestion, I created a fresh app (3.18) and downloaded the files to experiment with that. I put those 3 files in the .src directory and gb.media.form is NOT in the project properties. Right from the start I get "unknow identifier: MediaPlayer" on line 9 of FMediaPlayer.class. Did I miss a step? Your instructions seem fairly clear.
This is strange. I just did 10 consecutive tests with your timer code. It worked just fine. I do not know why I had trouble with it initially. That issue "appears" to be solved
Posted
Guru

you must still add gb.media for the MediaPlayer.class that MediaView uses.
just remove gb.media.form that is the now imported MediaView.class
then we can forget the Timer function
Posted
Regular

BruceSteers said
MediaPlayer is from gb.media
you must still add gb.media for the MediaPlayer.class that MediaView uses.
just remove gb.media.form that is the now imported MediaView.class
then we can forget the Timer function
Thanks Bruce. I should have realized that
Posted
Regular

Posted
Guru

The code is what MediaView is.
You should not be using (modifying) the actual MediaView code to just play stuff.
by adding the component code to your project you are simply importing your own version of MediaView.
usage of a MediaView in your project is then the same as normal.
Posted
Regular

BruceSteers said
I don't know what you mean?
The code is what MediaView is.
You should not be using (modifying) the actual MediaView code to just play stuff.
by adding the component code to your project you are simply importing your own version of MediaView.
usage of a MediaView in your project is then the same as normal.
Thanks Bruce. I'll recheck to see what I did wrong. I'm actually working on another thing at the moment. I think I finally understand how to use a background task!
1 guest and 0 members have just viewed this.


