MediaView question

Post your Gambas programming questions here.
Post Reply
User avatar
sholzy
Regular
Posts: 164
Joined: Sat Nov 26, 2016 2:52 am
Location: Florida

MediaView question

Post by sholzy »

I've had a lot of extra time on my hands this past week so I've had time to work on some of my coding projects (Gambas and Android). The project I've been struggling with the most is using the MediaView. This project is the first time using MediaView and has been the most challenging for me.

My project is a front end viewer for my security camera feeds. Some of my cameras are set to self maintain (reboot) at certain times which stops the video feed. I haven't been able to figure out how to "watch" the stream to know when the video feed has stopped. Currently I just hit a "refresh" button to restart the feed. I could hard code in the times to restart the video when the cameras come back online, but the program pulls from a db as to which video feed goes to which MediaView display (there can be up to 6 displays available). I would like for the program to be able to automatically restart the feed on it's own when the feed stops.

I've seen the MediaView.State, but that started on 3.19 and I'm still on 3.18 with no way to update yet. I've seen in a post awhile back about using MediaView.Status, but I don't see anything like that for a Media.View.

Any suggestions or ideas short of hard coding in the times?

Thanks!
sholzy

You may start a journey with certain goals or objectives, but things don’t always turn out the way you expect them to.
BruceSteers
Legend
Posts: 2089
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: MediaView question

Post by BruceSteers »

MediaView can be limited.

Does MediaView_AboutToFinish() event not trigger?

I would suggest for any advanced usage import the MediaView component files from the latest gb.media.form source and remove built in gb.media.form from the properties.
https://gitlab.com/gambas/gambas/-/tree ... .form/.src
(you do not need FTest.class / FTest.form)

Then edit/modify at will.

there can be many advantages to importing components.
at least you can have the .State property if you import the latest version :)

At best you can add your own events/methods :)
User avatar
gbWilly
Site Admin
Posts: 153
Joined: Fri Sep 23, 2016 11:41 am
Location: Netherlands
Contact:

Re: MediaView question

Post by gbWilly »

sholzy wrote: Sat Apr 12, 2025 6:00 pm I've seen the MediaView.State, but that started on 3.19 and I'm still on 3.18 with no way to update yet.
Thanks!
What mysterious system are you running that you can't update?
If it is debian, try my local file repo's and select whatever version you wanna stick to for now.
3.19.6 is one of the options...
gbWilly
- Dutch translation for Gambas3
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- Gambas3 Debian/Ubuntu repositories

- GambOS

... there is always a Catch if things go wrong!
User avatar
sholzy
Regular
Posts: 164
Joined: Sat Nov 26, 2016 2:52 am
Location: Florida

Re: MediaView question

Post by sholzy »

BruceSteers wrote: Sat Apr 12, 2025 8:37 pm MediaView can be limited.

Does MediaView_AboutToFinish() event not trigger?
I haven't tried the _AboutToFinish() event since my thinking is it would need to know the total length of the video in order to trigger near the end of the video.

BruceSteers wrote: Sat Apr 12, 2025 8:37 pm I would suggest for any advanced usage import the MediaView component files from the latest gb.media.form source and remove built in gb.media.form from the properties.
https://gitlab.com/gambas/gambas/-/tree ... .form/.src
(you do not need FTest.class / FTest.form)

Then edit/modify at will.

there can be many advantages to importing components.
at least you can have the .State property if you import the latest version :)

At best you can add your own events/methods :)
I never knew I could do something like that. I'll have to look into that. Do I import it directly into my project, or into my Gambas install? Being able to have .State would be perfect.

My only other option would be to add fields to the db to be able to set "refresh" times for each camera. (a kludge)
sholzy

You may start a journey with certain goals or objectives, but things don’t always turn out the way you expect them to.
User avatar
sholzy
Regular
Posts: 164
Joined: Sat Nov 26, 2016 2:52 am
Location: Florida

Re: MediaView question

Post by sholzy »

gbWilly wrote: Sat Apr 12, 2025 9:00 pm
sholzy wrote: Sat Apr 12, 2025 6:00 pm I've seen the MediaView.State, but that started on 3.19 and I'm still on 3.18 with no way to update yet.
Thanks!
What mysterious system are you running that you can't update?
If it is debian, try my local file repo's and select whatever version you wanna stick to for now.
3.19.6 is one of the options...
Ha! I was just thinking about those when your post popped up!
sholzy

You may start a journey with certain goals or objectives, but things don’t always turn out the way you expect them to.
User avatar
gbWilly
Site Admin
Posts: 153
Joined: Fri Sep 23, 2016 11:41 am
Location: Netherlands
Contact:

Re: MediaView question

Post by gbWilly »

sholzy wrote: Sat Apr 12, 2025 9:09 pm Ha! I was just thinking about those when your post popped up!
I'm currently building the renewed 3.20.2 binaries, so by end of tomorrow I might have all tested and published.
But all before 3.20.2 recipes and repo's have been renewed.

Matter of extracting archive and excuting script and it is installed.
Hint: Use some common place (like /usr/share/<some dir> to unpack)
gbWilly
- Dutch translation for Gambas3
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- Gambas3 Debian/Ubuntu repositories

- GambOS

... there is always a Catch if things go wrong!
BruceSteers
Legend
Posts: 2089
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: MediaView question

Post by BruceSteers »

sholzy wrote: Sat Apr 12, 2025 9:07 pm
BruceSteers wrote: Sat Apr 12, 2025 8:37 pm MediaView can be limited.

Does MediaView_AboutToFinish() event not trigger?
I haven't tried the _AboutToFinish() event since my thinking is it would need to know the total length of the video in order to trigger near the end of the video.

BruceSteers wrote: Sat Apr 12, 2025 8:37 pm I would suggest for any advanced usage import the MediaView component files from the latest gb.media.form source and remove built in gb.media.form from the properties.
https://gitlab.com/gambas/gambas/-/tree ... .form/.src
(you do not need FTest.class / FTest.form)

Then edit/modify at will.

there can be many advantages to importing components.
at least you can have the .State property if you import the latest version :)

At best you can add your own events/methods :)
I never knew I could do something like that. I'll have to look into that. Do I import it directly into my project, or into my Gambas install? Being able to have .State would be perfect.

My only other option would be to add fields to the db to be able to set "refresh" times for each camera. (a kludge)
Either put the files directly in you projects .src folder or in their own folder (in .src/)
Ie. yes it's project independent and does not effect your main gambas installation.
BruceSteers
Legend
Posts: 2089
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: MediaView question

Post by BruceSteers »

Here's an example...

It's a project with it's own MediaView (latest version) that fires End and Stop events..

you'll have to use diff or meld to see the additions i made.

To test it, use the IDE and set your own URL in the MediaView

It mostly involves adding the Events and a _RaiseEvent(sName) method to MediaView.class

Then from FMediaPlayer.class I can use something like the following to trigger the event..
GetParent()._RaiseEvent("End")
You do not have the required permissions to view the files attached to this post.
User avatar
sholzy
Regular
Posts: 164
Joined: Sat Nov 26, 2016 2:52 am
Location: Florida

Re: MediaView question

Post by sholzy »

BruceSteers wrote: Sun Apr 13, 2025 8:43 am Either put the files directly in you projects .src folder or in their own folder (in .src/)
Ie. yes it's project independent and does not effect your main gambas installation.
That's easy enough, thanks!

BruceSteers wrote: Sun Apr 13, 2025 12:21 pm Here's an example...

It's a project with it's own MediaView (latest version) that fires End and Stop events..

you'll have to use diff or meld to see the additions i made.

To test it, use the IDE and set your own URL in the MediaView

It mostly involves adding the Events and a _RaiseEvent(sName) method to MediaView.class

Then from FMediaPlayer.class I can use something like the following to trigger the event..
GetParent()._RaiseEvent("End")
I'll try this out when I get some more free time.
sholzy

You may start a journey with certain goals or objectives, but things don’t always turn out the way you expect them to.
Post Reply