Jump to content
Sign in to follow this  
Tntman

Android to Delphi syntax [PlaybackParams] [PlaybackSpeed]

Recommended Posts

Hello, I was developing a mobile application for my school, I were using Delphi Rad Studio Rio 10.3.

Here is brief description what application is doing: in some editboxes user adds data -> proceed to next tab 

On second tab user is choosing video that he wants to preview, while video is playing he is clicking some buttons to mark duration of some activities on video that he loaded ...

After that i am making a PDF report and saving to storage.

 

I made whole application and it is working great, problem is that I used this library for slowing down video preview -> https://github.com/Zeus64/alcinoe  i had some issues with this library ( most of them were configuration issues ) but at the end I managed to resolve all of them and make my app.

 

So why I used this library? Answer is that it had option to set speed preview of video. 

Before I started using this library i was trying for a few days to implement this -> https://stackoverflow.com/questions/18526336/playback-video-in-slow-motion-in-android   check answer from " karanatwal.github.io "

 

Problem was that I didnt know how to rewrite this android code into delphi FMX code :

 

videoview = (VideoView)findViewById(R.id.videoview);
videoview.setVideoURI("Your Video URI"); 
videoview.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    //works only from api 23
                    PlaybackParams myPlayBackParams = new PlaybackParams();
                    myPlayBackParams.setSpeed(0.5f); //here set speed eg. 0.5 for slow 2 for fast mode
                    mp.setPlaybackParams(myPlayBackParams);

                    videoview.start();//start your video.
                }
        });

So now I would like to rebuild my application and exclude this " alcinoe " library cuz I use it only for setting playback speed.. 
Can somebody help me rewriting this to a delphi code ? Thank you

 

 

EDIT: I will later post code snippet of how i retrieve path of video and how i load it, code is not that great because it was one of my first projects but maybe it will help someone who reads this.

Edited by Tntman

Share this post


Link to post
7 hours ago, Tntman said:

Problem was that I didnt know how to rewrite this android code into delphi FMX code

You cannot rewrite that java code into Delphi code, since it is creating a descendant of a Java class, which is presently not possible with Delphi. You can however create descendant in Java code that can then be consumed by Delphi.

 

I've been meaning to do a blog post about this for quite some time now because it requires a fair amount of explanation as to how to go about it.

Share this post


Link to post
1 hour ago, Dave Nottage said:

You cannot rewrite that java code into Delphi code, since it is creating a descendant of a Java class, which is presently not possible with Delphi. You can however create descendant in Java code that can then be consumed by Delphi.

 

I've been meaning to do a blog post about this for quite some time now because it requires a fair amount of explanation as to how to go about it.

At the end I though that it is not possible.. At least with my current knowledge delphi syntax and Android... Thank you for explaining it to me, I will try to google more about the stuff you mentioned in your post sounds like interesting topic to learn from

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×