Home page: http://www.delphicity.com
Contact: contact@delphicity.com
NOTE TO DELPHI 4 USERS:
If you get thread errors when running your project from the IDE,
apply the Delphi 4 Update Pack #3 (update Pack #2 is required).
You can download them from
http://www.borland.com/devsupport/delphi/downloads/index.html
NOTE TO DELPHI 6 USERS:
When running your project from the IDE, Delphi sometimes crashes
when opening DIVX clips (this is a D6 specific problem, that does
not occur with other Delphi versions). In this case, run your project
out of the IDE to try DIVX clips.
NOTE TO C++BUILDER USERS:
When creating a new project using TActiveMovie, uncheck "Build with
runtime packages" in Project | Options | Packages.
1. If a previous TActiveMovie package is already installed, remove it first:
- Components | Install Packages
- Click on "DelphiCity TActiveMovie"
- Click "Remove"
- Click "Yes"
- Click "Ok".
- search for "TAMovie.*" and "AMov*.*" files in your Borland directories and delete them, to be certain that old units will not remain in the search paths (causing later raw errors).
2. Install the current package:
- Unzip the archive in a folder of your choice (e.g. c:\amovie)
- According to your Delphi or C++Builder
version,
copy all the Delphi?\*.* or CBuilder?\*.* archive files to the
Borland\Delphi?\Imports or \Borland\CBuilder?\Imports directory,
- Run Delphi or C++Builder,
- Select Component | Install packages,
- Press the "Add" button,
- Locate the TAMovie.bpl file in the Imports directory and select it,
- Select Open
- Select Ok
- Check the ActiveX tab in the right of the component palette. The TActiveMovie object should have been added.
- place a TActiveMovie component from the ActiveX palette on your Project,
- place a button on your Project. In the ButtonClick event, add the following code:
ActiveMovie1.FileName := 'your media file
path or url';
ActiveMovie1.OpenSync;
- run your project.
- place a TActiveMovie component from the ActiveX palette on your Project,
- disable the ShowControls property,
- set the DisplaySize property to mpCustomSize,
- at runtime, change the ActiveMovie1.ZoomSize value from 100 (original size) to the desired percentage.
The
still capture isThe CaptureSize property resizes the frame at capture time in percent of its original size.
The capture methods are:
CaptureFrameToBmpFile -> create
sCaptureFrameToImage
-> stores the captured frame in a TImage.
NOTE: you have to create then TImage before calling the function.
CaptureFrameToBitmap
-> stores the captured frame in a TBitmap.
NOTE: the TBitmap is created by the function.
Here are listed the most useful methods, properties and events, grouped by their logical use:
Open:
procedure Open;
procedure OpenSync;
procedure Close;property FileName: WideString;
property OpenState: Integer; (read only)
event OnOpenComplete (Sender: TObject);
event OnOpenStateChange (Sender: TObject; OldState: Integer; NewState: Integer);
procedure Play;
procedure Pause;
procedure Stop;
procedure FastForward2 (Step: Double);
procedure FastReverse2 (Step: Double);property SelectionEnd : Double;
property SelectionStart : Double;
property AutoStart: WordBool;
property ClickToPlay: WordBool;
property PlayState: Integer; (read only)
event OnPlayStateChange (Sender: TObject; OldState: Integer; NewState: Integer);
property DisplayLogo: WordBool;
property DisplaySize: TDisplaySize;
property FullScreenMode: WordBool;
property Rate: Double;
property ShowControls: WordBool;
property ImageSourceHeight: integer; (read only)
property ImageSourceWidth: integer; (read only)
event OnFullScreenKeyDown;
Zoom:
Zooming is enabled when DisplaySize is set to mpCustomSize.
property ZoomSize: integer;
property ShowScrollBars: WordBool;procedure ScrollHorz (Min, Position, Max: integer);
procedure ScrollVert (Min, Position, Max: integer);
property CaptureSize: Integer;
function CaptureFrameToBmpFile (FileName: WideString): WordBool;
function CaptureFrameToImage (Image: TImage): WordBool;
function CaptureFrameToBitmap (Bitmap: TBitmap): WordBool;
CurrentPosition and Duration returns either the time in seconds, either the number of frames according to the DisplayMode property. Some media files do not return the frame information when DisplayMode = mpFrames.
If no frame information is needed, prefer to set DisplayMode to mpTime and use the CurrentPosition and Duration properties.
If the frame information is available, it is returned by FramePosition and FrameCount.
TotalTime and TimePosition are intended to return the time information when DisplayMode = mpFrames (avoiding to have to switch display mode to mpTime to get the time information).
Time and/or Frame information:
property DisplayMode: TDisplayMode;
property CurrentPosition: Double;
property Duration: Double; (read only)
property IsDurationValid: WordBool; (read only)
event OnPositionChange (Sender: TObject; OldTimePosition, NewTimePosition: Double; OldFramePosition, NewFramePosition: LongWord);Time information:
property TotalTime: Double;
property TimePosition: Double;Frame information:
property FramePosition: Double;
property FrameCount: Double;
procedure AboutBox;
Displays version and copyright information about the Windows Media Player
control.
procedure Cancel;
Cancels the Open method before the file completes opening.
function CaptureFrameToBmpFile
(FileName: WideString): WordBool;
Captures the current frame to FileName in BMP format.
The final size of the bitmap is given by the CaptureSize
property in percent of the original frame. Returns true on success.
function CaptureFrameToImage
(Image: TImage): WordBool;
Captures the current frame to the Image parameter. The TImage must have been
created before the function call. Returns true on success.
The final size of the bitmap is given by the CaptureSize
property in percent of the original frame. Returns true on success.
function CaptureFrameToBitmap(Bitmap:
TBitMap): WordBool;
Captures the current frame to the Bitmap parameter. The TBitmap must have
been created before the function call. Returns true on success.
The final size of the bitmap is given by the CaptureSize
property in percent of the original frame. Returns true on success.
procedure Close;
Stops playing a clip. Closes the clip.
procedure FastForward;
Scans rapidly forward through the current clip if AllowScan
is true.
Note: not all the files support scanning. The FastForward2 method below always
work.
procedure FastForward2
(Step: Double);
Scans rapidly forward through the current clip. The new position is the clip's current
position
+ (the clip's duration / Step).
procedure FastReverse;
Scans rapidly backward through the current clip if AllowScan
is true.
Note: not all the files support scanning. The FastForward2 method below always
work.
procedure FastReverse2
(Step: Double);
Scans rapidly backward through the current clip. The new position is the clip's current
position
+ (the clip's duration / Step).
function GetCodecDescription (CodecNum:
Integer): WideString;
Retrieves the descriptive name of the given codec.
function GetCodecInstalled (CodecNum:
Integer): WordBool;
Retrieves a value indicating whether a given codec is installed.
function GetCodecURL(CodecNum:
Integer): WideString;
Retrieves the URL location containing additional information about the given
codec.
procedure GetMarkerName (MarkerNum:
Integer);
Retrieves the name of a marker, given its marker number.
procedure GetMarkerTime (MarkerNum:
Integer);
Retrieves a value indicating the presentation time of a given marker.
function GetMediaInfoString
(MediaInfoType: MPMediaInfoType): WideString;
Retrieves show or clip information.
Type possible values for the MediaInfoType parameter are:
mpShowFilename
mpShowTitle
mpShowAuthor
mpShowCopyright
mpShowRating
mpShowDescription
mpShowLogoIcon
mpClipFilename
mpClipTitle
mpClipAuthor
mpClipCopyright
mpClipRating
mpClipDescription
mpClipLogoIcon
mpBannerImage
mpBannerMoreInfo
mpWatermark
function GetMoreInfoURL
(MoreInfoType: MPMoreInfoType): WideString;
Retrieves a URL to additional information about the presentation.
The possible values of the MoreInfoType parameter are:
mpShowURL
mpClipURL
mpBannerURL
function GetStreamGroup
(StreamNum: Integer): Integer;
Retrieves the group associated with the given media stream.
function GetStreamName (StreamNum:
Integer): WideString;
Retrieves the name of the given stream.
function GetStreamSelected (StreamNum:
Integer): WordBool;
Retrieves a value indicating whether the given stream is currently selected.
function IsSoundCardEnabled :WordBool;
Retrieves a value indicating whether the computer's sound card is enabled.
procedure Next;
Jumps to the next clip in a playlist.
procedure Open;
Asynchronously opens a clip specified in the FileName
property (Open does not wait until open completion. Test NewState in the OnOpenStateChange
event to know when the clip is really opened).
procedure OpenSync;
synchronously opens a clip specified in the FileName
property (waits until open completion).
procedure Pause;
Suspends playback at the current position in the clip.
procedure Play;
Starts playing a clip from the starting position or continues playing a paused
or stopped clip.
procedure Previous;
Jumps to the previous clip in a playlist.
procedure ScrollHorz (Min, Position, Max:
integer);
Scrolls horizontally the clip's window, allowing to see the hidden part of a
zoomed window. Has no effect if DisplaySize <>
mpCustomSize or
if the clip fits inside its parent control. To center the clip set the default
Position to equal distance between Min and Max.
procedure ScrollVert (Min, Position, Max:
integer);
Scrolls vertically the clip's window, allowing to see the hidden part of a
zoomed window. Has no effect if DisplaySize <>
mpCustomSize or
if the clip fits inside its parent control. To center the clip set the default
Position to equal distance between Min and Max.
procedure Stop;
Stops playback of the current clip. Reset the current clip's position to 0.
procedure StreamSelect (StreamNum:
Integer);
Selects the media stream indicated by the specified stream number.
property Bandwidth: integer;
Retrieves the bandwidth of the current clip in bits per second.
property BufferingCount: integer;
Retrieves the number of times buffering occurred during playback of a clip.
property BufferingProgress: integer;
Retrieves the percentage of buffering completed.
property BufferingTime: Double;
Retrieves a the buffering time in seconds.
property CanPreview: WordBool;
Retrieves a value indicating whether the current content contains a playlist
that can be previewed.
property CanScan: WordBool; Retrieves a value indicating whether the current file supports scanning.
property CanSeek: WordBool; Retrieves a value indicating whether the current file has the ability to seek to a specific time.
property CanSeekToMarkers: WordBool; Retrieves a value indicating whether markers in the file can be located with a seek operation.
property ChannelDescription:
WideString;
Retrieves the station description.
property ChannelName: WideString;
Retrieves the station name.
property ChannelURL: WideString;
Retrieves the URL of the station metafile.
property ClientID: WideString;
Retrieves the unique ID of a client.
property CodecCount : Integer;
Retrieves the number of installable codecs used by the current clip.
property ConnectionSpeed :Integer;
Retrieves the bandwidth selected during setup.
property ContactAddress: WideString;
Retrieves the station's contact address.
property ContactEmail:
WideString;
Retrieves the station's e-mail address.
property ContactPhone:
WideString;
Retrieves the station's contact telephone number.
property CreationDate: TDateTime;
Retrieves the date and time when the clip was created.
property CurrentMarker:
Integer;
Specifies or retrieves the current marker number.
property CurrentPosition: Double;
Retrieves the current position in seconds or in frames according to DisplayMode.
Use FramePosition of TimePosition
to avoid testing DisplayMode.
Note: the frame position can be unavailable (e.g. : not returned by asf files).
property Duration: double;
Retrieves the length of the clip, in seconds or in frames according to DisplayMode.
Use FrameCount or TotalTime
to avoid testing DisplayMode.
Note: the frame count can be unavailable (e.g. : not returned by asf files).
property EntryCount: Integer;
Retrieves the number of entries contained in the current Windows Media metafile.
property ErrorCode: integer;
Retrieves the current error code.
property ErrorCorrection: WideString;
Retrieves the error correction type of the current clip.
property ErrorDescription: WideString;
Retrieves a description of the current error state.
property FrameCount:
LongWord;
Retrieves the number of frames of the clip. The frame count can be
unavailable (e.g.: not returned by asf files). In this case, FrameCount returns
0.
property FramePosition:
LongWord;
Retrieves current frame position of the clip. The frame position can be
unavailable (e.g.: not returned by asf files). In this case, FramePosition
returns 0.
property HasError: WordBool;
Retrieves a value indicating whether the Windows Media Player control
currently has an error.
property HasMultipleItems: WordBool;
Retrieves a value indicating whether the current clip contains multiple
items (playlists).
property ImageSourceHeight: integer;
Retrieves the original image height of the current clip, in pixels.
property ImageSourceWidth: Integer;
Retrieves the original image width of the current clip, in pixels.
property IsBroadcast: WordBool;
Retrieves a value indicating whether the source is broadcast.
property IsDurationValid: WordBool;
Retrieves a value indicating whether the value of the Duration
property is valid.
property LostPackets: integer;
Retrieves the number of packets lost during transmission of the stream.
property MarkerCount: Integer;
Retrieves the number of markers in the current clip.
property OpenState:
integer;
Retrieves the state of the content source. The possible returned values are:
nsClosed: content file is closed,
nsLoadingASX: loading a Windows Media metafile,
nsLoadingNSC: loading an .nsc station file,
nsLocating: locating the server,
nsConnecting: connecting to the server,
nsOpening: opening or listening for the stream,
nsOpen: content file is open.
property PlayState:
integer;
Retrieves a value indicating the state of the Windows Media Player
operation.
The possible values are:
mpStopped
mpPaused
mpPlaying
mpWaiting
mpScanForward
mpScanReverse
mpClosed
property ReadyState:
integer;
Retrieves the state of readiness of the Windows Media Player control.
The possible values are:
amvUninitialized
amvLoading
amvInteractive
amvComplete
property ReceivedPackets:
integer;
Retrieves the number of packets received.
property ReceptionQuality: integer;
Retrieves the percentage of packets received in the last 30 seconds.
property RecoveredPackets: integer;
Retrieves the number of packets recovered.
property SourceLink: WideString;
Retrieves the path to the current clip.
property SourceProtocol: integer;
Retrieves a value indicating the protocol used to receive data.
property StreamCount: Integer;
Retrieves the number of media streams in the current clip.
property TimePosition: Double;
Retrieves the current position of the clip, in seconds.
property TotalTime: double;
Retrieves the length of the clip, in seconds.
property TrackingInterval:
Integer;
Retrieves or set the interval between 2 time/frame positions calculations
and OnPositionChangeEvents if the current
position changed. The default value is 50 ms. This value is critical. Be careful
when changing it.
property AllowScan: WordBool;
Specifies or retrieves a value indicating whether scanning is enabled for
files that support scanning (fast-forwarding and rewinding).
property AnimationAtStart:
WordBool;
Specifies or retrieves a value indicating whether animation runs before the
first image is displayed.
property AudioStream: Integer;
Specifies or retrieves the stream number of the current audio stream.
property AutoRewind: WordBool;
Specifies or retrieves a value indicating whether the Windows Media Player
control automatically returns to the clip's starting point after the clip
finishes playing or has otherwise stopped.
property AutoStart: WordBool;
Specifies or retrieves a value indicating whether to start playing the clip
automatically.
property Balance: integer;
Specifies or retrieves a value indicating the stereo balance.
property BaseURL: WideString;
Retrieves a value indicating the base URL.
property CaptioningID: WideString;
Retrieves the name of the frame or control that displays captioning.
off.
property CaptureSize:
integer;
The size of the captured frame in percentage of the source size (default =
100). Applies to CaptureFrameToBmpFile, CaptureFrameToImage
and CaptureFrameToBitMap.
property Color:
TColor;
Specifies or retrieves a value indicating the color of the background when ShowControls
is disabled.
property ClickToPlay: WordBool;
Specifies or retrieves a value indicating whether the user can toggle
playback on and off by clicking the video image.
property CursorType:
Integer;
Specifies or retrieves the cursor type.
property DefaultFrame: WideString;
Specifies or retrieves a value representing the default target HTTP frame.
property DisplayLogo:
WordBool;
Specifies or retrieves wether the Window Media logo is displayed when there
is no clip opened.
property DisplayMode:
TDisplayMode;
Specifies or retrieves a value indicating whether the status bar displays the
current position in seconds or frames.
TDisplayMode = (mpTime, mpFrames);
property DisplaySize:
TDisplaySize;
TDisplaySize = (mpDefaultSize, mpHalfSize, mpDoubleSize, mpFitToSize,
mpCustomSize);
Specifies or retrieves the size of the image display window.
Note:
- mpCustomSize allow zooming according to the ZoomSize
property.
- mpCustomSize is not compatible with ShowControls.
ShowControls must be disabled to set DisplaySize to mpCustomSize.
property EnableContextMenu:
WordBool;
Specifies or retrieves a value indicating whether the context menu appears
when the user clicks the right mouse button.
property Enabled: WordBool;
Specifies or retrieves a value indicating whether the Windows Media Player
control is enabled.
property EnableFullScreenControls:
WordBool;
Specifies or retrieves a value indicating whether Windows Media Player
displays controls in full-screen mode.
property EnablePositionControls:
WordBool;
Specifies or retrieves a value indicating whether the position controls are
enabled on the control bar.
property EnableTracker: WordBool;
Specifies or retrieves a value indicating whether the trackbar control is
enabled.
property FileName: WideString;
Specifies or retrieves the name of the clip to play. The clip can be opened
by the Open or OpenSync procedures.
property FullScreenMode: WordBool;
Specifies if the Media Player must be displayed in full-screen mode.
property InvokeURLs: WordBool;
Specifies or retrieves a value indicating whether the Windows Media
Player control automatically invokes URLs in a browser (URL flipping).
property Language: Integer;
Specifies or retrieves a value indicating the current locale used for
national language support.
property Mute: WordBool;
Specifies or retrieves the current mute state of the Windows Media Player
control.
property ParentColor:
Boolean;
Specifies or retrieves a value indicating that the parent's color must be used
for the background when ShowControls is disabled.
property PlayCount: integer;
Specifies or retrieves the number of times a clip plays.
property Rate: Double;
Specifies or retrieves the playback rate of the clip. Rate = 1 correspond to
the nominal speed. Microsoft recommends values between 0.5 and 1.5. Values
greater than 1.5 work well. Values lower than 0.5 give various results depending
of the media file type.
property SAMIFileName: WideString;
Specifies or retrieves the name of the file that contains the closed
captioning information.
property SAMILang: WideString;
Specifies or retrieves a value indicating the language displayed for closed
captioning.
property SAMIStyle: WideString;
Specifies or retrieves a value representing the closed captioning
style.
property SelectionEnd : Double;
Specifies or retrieves the time within the current clip at which
playback will stop.
property SelectionStart: Double;
Specifies or retrieves the time within the current clip at which
playback will begin.
property SendErrorEvents: WordBool;
Specifies or retrieves a value indicating whether the Windows Media Player
control sends error events.
property SendKeyboardEvents:
WordBool;
Specifies or retrieves a value indicating whether the Windows Media Player
control sends keyboard events.
property SendMouseClickEvents:
WordBool;
Specifies or retrieves a value indicating whether the Windows Media
Player control sends mouse click events.
property SendMouseMoveEvents:
WordBool;
Specifies or retrieves a value indicating whether the Windows Media Player
control sends mouse move events.
property SendOpenStateChangeEvents:
WordBool;
Specifies or retrieves a value indicating whether the Windows Media
Player control sends open state change events.
property SendPlayStateChangeEvents:
WordBool;
Specifies or retrieves a value indicating whether the Windows Media Player
control sends play state change events.
property SendWarningEvents:
WordBool;
Specifies or retrieves a value indicating whether the Windows Media Player
control sends warning events.
property ShowAudioControls:
WordBool;
Specifies or retrieves a value indicating whether the audio controls appear
on the control bar.
property ShowCaptioning: WordBool;
Specifies or retrieves a value indicating whether the closed caption area is
visible and closed captioning is enabled.
property ShowControls: WordBool;
Specifies or retrieves a value indicating whether the control bar is
visible.
property ShowDisplay: WordBool;
Specifies or retrieves a value indicating whether the display panel is
visible.
property ShowGotoBar: WordBool;
Specifies or retrieves a value indicating whether the Go To bar is
visible.
property ShowPositionControls:
WordBool;
Specifies or retrieves a value indicating whether the position controls
appear on the control bar.
property ShowScrollBars:
WordBool;
Specifies or retrieves a value indicating whether scrollbars are displayed
when the media height, width or both are greater that the control's size.
property ShowStatusBar: WordBool;
Specifies or retrieves a value indicating whether the status bar is visible.
property ShowTracker: WordBool;
Specifies or retrieves a value indicating whether the trackbar is visible.
property VideoBorder3D: WordBool;
Specifies or retrieves a value indicating whether the
three-dimensional video border effect is enabled.
property VideoBorderColor: TColor;
Specifies or retrieves the color of the video border.
property VideoBorderWidth: Integer;
Specifies or retrieves the width of the video border, in pixels.
property Volume: Integer;
Specifies or retrieves the volume, in hundredths of decibels.
property ZoomSize: integer;
Specifies or retrieves the zoom size in percent of the original clip size.
This property is effective if DisplaySize = mpCustomSize and ShowControls is
disabled. Default = 100.
property OnBuffering
(Sender: TObject; Start: WordBool);
Occurs when the Windows Media Player control begins or ends buffering.
property
OnDisconnect (Sender:
TObject; Result: Integer);
Occurs when the Windows Media Player control is disconnected from the server.
property OnDisplayModeChange (Sender:
TObject);
Occurs when the DisplayMode property changes.
property OnEndOfStream (Sender:
TObject; Result: Integer);
Occurs when the end of the clip is reached.
property (Sender: TObject);
Occurs when the Windows Media Player control has an error condition.
property OnFullScreenKeyDown
(Sender: TObject; VirtualKey, KeyData: LongInt)
When the media is displayed in full screen mode, all the keyboard events are
returned by this event. The VirtualKey contains the key's code.
property OnMarkerHit (Sender: TObject;
MarkerNum: Integer);
Occurs when a marker is reached.
property OnNewStream (Sender:
TObject);
Occurs when a new stream is started in a station.
property OnOpenComplete (Sender: TObject);
Occurs when the clip has been fully loaded. Equivalent to NewState = nsOpen
in the OnOpenStateChange event.
property OnOpenStateChange
(Sender: TObject; OldState: Integer; NewState: Integer);
Occurs when the Windows Media Player control changes its open state. See the OpenState
property for the NewState possible values.
property OnPlayStateChange
(Sender: TObject; OldState: Integer; NewState: Integer);
Occurs when the Windows Media Player control changes its play
state. See the PlayState property for the NewState
possible values.
property OnPositionChange
(Sender: TObject; OldTimePosition, NewTimePosition: Double; OldFramePosition,
NewFramePosition: LongWord);
Occurs when the current media position moves to a new position. The time
positions are in seconds, the frame positions in numbers of frames.
property OnReadyStateChange
(Sender: TObject; ReadyState: ReadyStateConstants);
Occurs when the Windows Media Player control's state of readiness changes.
See the ReadyState property for the ReadyState
possible values.
property OnScriptCommand
(Sender: TObject; const scType: WideString; const Param: WideString);
Occurs when a synchronized command or URL is received.
property OnWarning (Sender: TObject;
WarningType: Integer; Param: Integer; const Description: WideString);
Occurs when the Windows Media Player control encounters a possible problem.
OleErrorDisplayMsg:
String;
The message contained in OleErrorDisplayMsg is displayed at runtime if
the Window Media Player (version 6.4 or higher) is not installed on a
Windows 95 platform. (The Window Media Player v6.4 for Windows 95 can be
freely downloaded from the Microsoft web site).
The default value is:
Microsoft Windows Media Player is
not installed on this machine.
Download it at http://www.microsoft.com
This message replaces the standard OLE Error display. You can assign any message of your choice. To display the default OLE error, simply assign an empty String.
Q: I am using Delphi4. When starting a video from the IDE, sometimes Delphi reports thread errors.
A: This is a common problem with Delphi4. Apply the Update Packs #2 and #3 (the #3 solves the problem, the #2 is required by the #3). They can be downloaded at http://www.borland.com/devsupport/delphi/downloads/index.html. I had no more problems after applying these packs. If the problem persists, run your project out of the IDE.
Q: When I run my project from C++Builder, I get a 'CoInitialize has not been called' error.
A: Add a CoInitialize(NULL) statement in your main Form's OnCreate event and a CoUninitialise() statement in your main Form's OnDestroy event.
Q: I installed the Component as instructed, however when compile the demo, I receive the following error: "Unable to locate AmovCtl.pas".
A: It is a problem of search path: Delphi or C++ Builder cannot find the AMovCtl.dcu file, because the package has been installed in a directory that is not included in the Delphi or C++Builder search path.
In Tools | Environment Options | Library | Library path, you should have the TActiveMovie's component installation path declared. So, if you installed TActiveMovie in the Import directory, check in Delphi or C++Builder if this path exists ($(BCB)\Imports or $(DELPHI)\Imports).
If you installed TActiveMovie in another directory, you must add it either to the global search path above, either in your project's search path, in Project | Options | Directories/Conditional | Search Path.
Capture a frame to a JPEG file
Use a code like this:
procedure TForm1.Button1Click(Sender:
TObject);
var
BitMap: TBitMap;
Jpeg: TJpegImage;
begin
BitMap := TBitMap.Create;
if ActiveMovie1.CaptureFrameToBitMap (BitMap) then begin
Jpeg := TJpegImage.Create;
Jpeg.Assign (BitMap);
Jpeg.Performance := jpBestQuality;
Jpeg.CompressionQuality := 100;
Jpeg.SaveToFile ('yourfile.jpg');
Jpeg.Free;
end;
BitMap.Free;
end;
Automatically play another movie as soon as a first one has finished
There are several ways to do that. The
following code works fine:
- create the OpenNewStream procedure as follow,
- call OpenNewStream to play the first clip,
- in the ActiveMovie's OnEndOfStream event, call OpenNewStream with the next
clip to play as showed below.
procedure TForm1.OpenNewStream (MediaFile: string);
begin
if (ActiveMovie1.OpenState <> nsClosed) then begin
ActiveMovie1.Close;
end;
ActiveMovie1.AutoStart := True;
ActiveMovie1.FileName := MediaFile;
ActiveMovie1.OpenSync;
end;
procedure TForm1.ActiveMovie1EndOfStream(Sender: TObject; Result: Integer);
var
MediaFile: WideString;
begin
// replace the line below by your next clip selection
MediaFile := 'NextClip.mpeg';
OpenNewStream (MediaFile);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MediaFile: WideString;
begin
// replace the line below by your first clip selection
MediaFile := 'FirstClip.mpeg';
OpenNewStream (MediaFile);
end;
The author of this program accepts no responsibility for damages resulting from the use of this product and make no warranty or representation, either expressed or implied, including but not limited to, any implied warranty of merchantability or fitness for a practical purpose.
This software package is provided here "AS IS", and you the user, assume all risks when using them.
TActiveMovie is a VCL component for Delphi or C++ Builder. TActiveMovie now gives you full control on the Microsoft's Media Player from your project. You can adjust the sound volume, the speed rate, select the start and end positions of video clips. You can display videos in full screen, zoom in, zoom out, scroll horizontally and vertically. You can capture frames to TBitmap, TImage or directly to files. TActiveMovie saves you having to tangle with the Microsoft ActiveX interface. Most common parameters can be simply set from the Object Inspector. Register and you will get the full source code with 24 month upgrades.
|
REGISTRATION |
Click here to register.