B4J Question MediaPlayer Slow Motion

dieterp

Active Member
Licensed User
Longtime User
I require the ability to open a video file and perform various functions on it. One of those is to slow the video down or speed it up. Looking at the MediaPlayer properties it doesn't seem to have that functionality. Am I overlooking something, or is there another way to perform this task?

Also, is there a way to superimpose images onto the video either in pause mode or while it is playing?
 

moster67

Expert
Licensed User
Longtime User
You can use Vitamio5 which permits playing a video file in slow motion and fast speed (to a certain extent).
Alternatively you can use OpenCV or JavaCv but in this case you would need to wrap Java-code (and/or use Inline Java).
I am not aware of any other solutions.
 
Upvote 0

dieterp

Active Member
Licensed User
Longtime User
Thanks for the prompt feedback! I'll have a look at Vitamio5 and feedback if that doesn't offer a solution
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Oops, sorry. I just noted that you posted in the B4J-forum. Then Vitamio5 is not a solution since it is for B4A.
Maybe you can embed vlc or similar in B4J....
 
Upvote 0

dieterp

Active Member
Licensed User
Longtime User
Ok. I'll have a look at that too. This could also work for B4A for me. Ideally will require a solution for all the platforms
 
Upvote 0

udg

Expert
Licensed User
Longtime User
MediaPlayer seems to have what you need: get/setRate.
"The rate at which the media should be played. For example, a rate of 1.0 plays the media at its normal (encoded) playback rate, 2.0 plays back at twice the normal rate, etc. The currently supported range of rates is [0.0, 8.0]. The default value is 1.0."

Edit: something like the following
B4X:
Public Sub MediaRate(mp As MediaPlayer, rate As Double)
   Dim jo As JavaObject = mp
   jo.RunMethod("setRate",Array As Object(rate))
end sub
 
Last edited:
Upvote 0
Top