Delphi MediaPlayer adjust size - delphi

I have a simple form that loads and plays a video using the media player, and media player control components. Is there a way to resize the video played, using a scrollbar or something similar in RAD Studio XE6.

Resizing is usually done by resizing the form hosting the viewport, not with scrollbars. Try putting the media player in a sizable form or panel with anchors on all four sides so it expands and contracts as you adjust the corners of the form.

You can implement sort of ZoomIn or ZoomOut functionalitay by adjusting the DisplayRect property:
http://docwiki.embarcadero.com/Libraries/XE6/en/Vcl.MPlayer.TMediaPlayer.DisplayRect
First you would probably want to set DisplayRect to the size of the control/component which you have selected as rendering target using Display property:
http://docwiki.embarcadero.com/Libraries/XE6/en/Vcl.MPlayer.TMediaPlayer.Display
In order to avoid uneven wideo streching I recomend you add necessary code to be able to calculate proper DisplayRect dimensions while maintaing aspect ratio.
If you want you can make DisplayRect even larger than your rendering conroll. By doing this you realy achieve that ZoomIn effect.
Do note that this only strectches the video content so you may expirience loss of quality, becouse TMediaPlayer doesen't use any special filters for doing so as many comercial Media Players do.
EDIT: I don't have expirience about using of TMediaPlayer on FireMonkey platform but after looking at documentation it seems that things have been changed quite a bit.
For instance on FMX there is special component called TMediaPlayerControll which is required for rendering video on.
http://docwiki.embarcadero.com/Libraries/XE7/en/FMX.Media.TMediaPlayerControl
But looking at documentation I can't find any special properties or methods to controll the video size. So I gues that implementing of ZoomIn or ZoomOut functionality would be using the same approach as it can be used with normal FireMonkex components.

Related

Does the Camera Module for Kivy Allow Custom Framerates?

I'm an artist looking to make an app that utilizes the camera on an Android or Iphone device to display a stereoscopic video feed at 1 to 5 frames per second. Python/Kivy is what I (sort of) know, so I'm starting there. Does the Camera module in Kivy support inputting a custom framerate? The existing documentation doesn't seem to say.
(Also very open to simpler ways to accomplish this/existing applications).
It doesn't directly have a property to set for that, but it should be very easy to achieve. Off the top of my head, you could render the widget in an Fbo and only redraw the Fbo at the rate you require, but there's probably a neater solution.
Probably a bigger problem will be that the Camera support is not that robust, make sure you prototype first to understand what works and what doesn't - or at least what needs more custom work to do what you want.

Seeking advice on best way to build a graphic Control

I am trying to build a custom control which can draw the outline and pins of an integrated circuit.
At present I am using 2 frames, one holding a panel which will represent the package outline. THis frame will be place on a form. The other frame will represent a pin which will contain a shape to represent the pin and two labels, one for pin number one for pin description. My plan is to create the pins dynamically according to package aspect ratio and number of pins.
Are frames a good basis for this or are there better alternatives.
A frame is a good starting point but is heavy. Probably the best solution is to build a custom control. As ancestor, you could start either with TGraphicControl or TWinControl depending on the features you need. Read the documentation to select the best fit for your case.
TCustomControl which derive from TWinControl is a good ancestor for controls that wrap Windows screen objects but perform their own rendering.
The documentation I linked above gives examples of controls.

How to expand video cropping frame like native application?

I have issue with cropping video and also need to expand video
cropping frame like native application, whenever User tapped on
cropping fame I need to expand video frames(thumbnails) and also want
to crop it, but I don't understand how to do it.
Here's a link to an open source control that you can use as a foundation.
https://github.com/andrei200287/SAVideoRangeSlider
This control already generates thumbnails from the source video and draws a linear trim bar with draggable handles that let you set the start/end point of the video. All you'd need to do is add some code to reload the trim bar with detailed images from around the time of the handle that's being dragged at the moment.
This control also comes with a sample app that exports the trimmed video from the selected start and end points.
Hopefully that's what you're looking for.

How to set edge style on UILabel text

I'm working on adding custom captions to my iOS app that plays videos. I'd like to support all the features of CEA-708 (which are essentially rich-text captions), but I can't figure out how to apply the necessary edge-styles using a UILabel.
The image below shows the edge styles I want to support. However, I am struggling to find a way to achieve raised/depressed edges. Any ideas?
I don't think that those behaviors are expected in iOS. The only idea that I can suggest is to use two labels to achieve those effects, with different z-indexes and positions and colors to obtain the offset similar to the edge.
Otherwise, you can try to take a look to this link https://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_shadows/dq_shadows.html.

How to resize a directx window without flicker?

I have a simple directx application which displays some pre-transformed geometries and I want the window to not flicker when I resize it and also i want the drawings to not stretch with window size.
I noticed about the stretching problem that, if I reset the device in WM_SIZING then the actual size of the drawing retains. But resetting the device every time I resize the window seems like an expensive operation. Actually I wanted to create some simple GUI using directx, but resizing the window seems to erase the front buffer data and thus flicks.I saw many application with custom gui using opengl allows resizing also WPF application allows resizing. How do I do that?
Also I would like to know, if there is no way I can achieve the effect of real time resizing without flicker and repositioning of drawn elements then how do WPF applications manage to do that?
Also I want to ask that, if you were to design GUI(non game) system using directx and want to implement resizing support as any other application does what would be your option?
I want the window to not flicker when I resize it
Don't handle WM_ERASEBACKGROUND and similar messages. Leave all the painting to DirectX and there will be no flicker. Any flicker is basically you (or your controls) drawing something first, then DirectX drawing it's picture over it.
and also i want the drawings to not stretch with window size.
Not possible (at least without hacks). Assuming you use DirectX 9, you have to re-initialize the device to change it's resolution, and that is slow.
I can think of some workarounds to try, for instance, to change your projection matrix so that while the viewport resolution stays the same (no reinit), things that you see through your viewport reflect the window size.
In other words, you init your viewport to 640x480 and keep it at that, but if the user resizes your window to be 1024x768, you pack 1024x768 amount of things into your 640x480 viewport, which is then stretched to fill 1024x768 window.
This should give the impression that you "resize" the viewport, but since in fact it's scaling, picture quality will drop. Which is why you might want to reinit the viewport in the end, after the user is finished with resizing the window. This way you get quick resize first and picture quality afterwards.

Resources