Reputation: 1957
I am using Firemonkey to develop a Win64 video application.
I use TMediaPlayer and TMediaPlayerControl to play video files in full-screen mode.
I hope that when playing a video, the playback time, progress information, and several playback control buttons are superimposed on the playback screen.
But I found that these components added in TMediaPlayerControl cannot be displayed normally. I checked the source code related to TMediaPlayer, and found that the window of the video playback will always be displayed at the top layer, thus completely covering the components above TMediaPlayerControl.
Is there any way to solve this problem?
Upvotes: 3
Views: 293
Reputation: 21033
You can do it by adding a transparent overlay form on top (in z order) of the form where your TMediaPlayerControl
is. You make the form transparent by setting Transparency = True
. To make it stay on top of your main form set FormStyle = StayOnTop
. You also want to set its BorderStyle = None
.
Place all the buttons, panels etc. that you want to "float" above the video on this transparent form. As the form is transparent, the controls will appear to float in front of the video.
To control your TMediaPlayer
with controls on the transparent form, you need to add uses MainForm
under implementation
in the secondary form.
You will probably also like to synchronize the forms with respect to size changes in case used on different size displays. Use OnFormResize
on the main form. Check that the overlay form exists (e.g. if overlayForm <> nil then ...) before you attempt to access it, as it is created after the main form. Set width and height of the overlay form according to the main form. Resposition the controls as needed.
Upvotes: 3