Datastead Software

TActiveMovie
Version 5.
4  -   March 4, 2003

Home page:  http://www.datastead.com
         Mirror:  http://www.datastead.info

    Contact:  contact@datastead.com
    Support:  support@datastead.com

 



Package install

1.  If a previous TActiveMovie package is already installed, remove it first:

- Components | Install Packages
- Click on "datastead 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.

 

DELPHI 4 USERS: Apply the Delphi 4 Update Packs #2 and #3, otherwise you could get an error when installing the component on the palette, or thread errors at runtime. These update packs can be downloaded from http://www.borland.com/devsupport/delphi/downloads/index.html



Quick start guide

- 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.



Zooming

- 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.



Single frame capture

Overview

The single frame capture is invoked by calling one of the following functions, according to the destination of the frame:

function CaptureFrameToBmpFile (var FileName: String): WordBool;
function CaptureFrameToJPEGFile (var FileName: String): WordBool;
function CaptureFrameToImage (Image: TImage): WordBool;
function CaptureFrameToBitmap (Bitmap: TBitmap): WordBool;

For CaptureFrameToBmpFile and CaptureFrameToJPEGFile, the FileName property is passed as var, allowing TActiveMovie to automatically generate a file name and return it by the FileName parameter if FileName was assigned an an empty string (otherwise the FileName value passed to the function is used to save the file).  E.g.:

1. you give a file name to save the BMP or JPEG file:
procedure TForm1.Button1Click(Sender: TObject);
var
   FileName: String;
begin
   FileName:= 'c:\myfolder\myfile.jpg';
   if ActiveMovie1.CaptureFrameToJPEGFile (FileName) then begin
      ShowMessage ('created');
   end;
end;

2. you let TActiveMovie automatically assign a filename and create a file in the StoragePath directory according to the AutoFileName property on a sequential increment (AutoFileName = fn_Sequential) or time basis (AutoFileName = fn_DateTime). In this case simply assign an empty string to the FileName variable passed to the function:
procedure TForm1.Button1Click(Sender: TObject);
var
   FileName: String;
begin
   // an empty string = "please generate automatically a file name"
   FileName:= '';
   if ActiveMovie1.CaptureFrameToJPEGFile (FileName) then begin
      // FileName contains now the file name generated by TActiveMovie
      ShowMessage (FileName + 'created');
   end;
end;

Fast frame capture

If FGrabber_Enabled is enabled, the frame capture is processed by the frame grabber: the frame capture is faster, but this feature requires DirectX8.



Multiple frame capture with the Frame Grabber (DirectX8 required)

The frame grabber allows to capture quickly several frames (or all the frames) from only 1 statement call. 

This feature is based on DirectX8, so it won't be available if a previous version of DirectX is installed on the platform where the application runs.

The frame grabber works  asynchronously. That means that you set the grabber parameters, you call FGrabber_CaptureFrameTo one time, and then the captured frames are returned by the OnFGrabberCaptureCompleted event.

Using the frame grabber to capture 1 frame

- set FGrabber_Enabled = true to enable the frame grabber (this must be done before opening the clip),
- open the clip,
- set FGrabber_BurstMode = False do get only 1 frame
- call FGrabber_CaptureFrameTo
- the captured frame is returned by the OnFGrabberCaptureCompleted event.

Using the frame grabber to capture more than 1 frame

- set FGrabber_Enabled = true to enable the frame grabber (this must be done before opening the clip),
- open the clip,
- set FGrabber_BurstMode = true to allow more than 1 frame,
- set FGrabber_BurstCount = the number of frames to capture, or 0 to capture all the frames,
- set FGrabber_BurstInterval = 0 to capture successive frames, or a value n to capture 1 frame each n frames, until BurstCount has been reached.
- call FGrabber_CaptureFrameTo
- the captured frames are returned by the OnFGrabberCaptureCompleted event until BurstCount is reached (if BurstCount = 0, until BurstMode is disabled or the end of the clip has been reached).

FGrabber_CaptureFrameTo parameters

Frames are returned by the OnFGrabberCaptureCompleted event as a TBitmap, a BMP file or a JPEG file according to the Dest parameter passed to the FGrabber_CaptureFrameTo procedure. Dest can take one of the following values:
fc_TBitmap: captures the current frame to a memory bitmap,
fc_BmpFile: captures the current frame to a BMP file,
fc_JpegFile: captures the current frame to a JPEG file according to the JPEGPerformance, JPEGQuality and JPEGProgressiveDisplay values.

File name

When fc_BmpFile or fc_JpegFile is specified in the Dest parameter of the FGrabber_CaptureFrameTo procedure, a file name is automatically created in the StoragePath directory according to the AutoFileName property on a sequential increment (AutoFileName = fn_Sequential) or time basis (AutoFileName = fn_DateTime). This file name used to save the current frame is returned by the OnFGrabberCaptureCompleted event. 

Capture size

The CaptureSize property allows to resize the frame in percent of its original size. 
Remark:
- the capture is faster using a size of exactly 100%, because it is not necessary to resize the bitmap,
- using high zoom values (greater than 100%) may require excessive CPU time.



Common methods, properties and events

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);

Playback

procedure Play;
procedure PlayBackwards;
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);

Appearance

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 OnFullScreenKeyPress  (Sender: TObject; Key: Word; Shift: TShiftState);

Zoom

Note: zooming is enabled when ShowControls is disabled and DisplaySize is set to mpCustomSize.

property ZoomSize: integer;
property ShowScrollBars: WordBool;

procedure ScrollHorz (Min, Position, Max: integer);
procedure ScrollVert (Min, Position, Max: integer);

Single frame Capture

function CaptureFrameToBmpFile (var FileName: String): WordBool;
function CaptureFrameToJPEGFile (var FileName: String): WordBool;
function CaptureFrameToImage (Image: TImage): WordBool;
function CaptureFrameToBitmap (Bitmap: TBitmap): WordBool;

property AutoFileName: TAutoFileName;
property AutoFilePrefix: string;
property CaptureSize: Integer;
property JPEGPerformance: TJPEGPerformance;
property JPEGProgressiveDisplay: WordBool;
property JPEGQuality: TJPEGQualityRange;
property StoragePath: string;

Multiple frame Capture with the Frame Grabber

procedure FGrabber_CaptureFrameTo (Dest: TFrameCaptureDest; FileName: string);

event OnFGrabberCaptureCompleted (Sender: TObject; Bitmap: TBitmap; DestType: TFrameCaptureDest; FileName: string; Success: WordBool)

property AutoFileName: TAutoFileName;
property AutoFilePrefix: string
property BurstCount: Integer;
property BurstInterval: Integer;
property BurstMode: WordBool;
property CaptureSize: Integer;
property IsDirectX8Installed: WordBool;
property JPEGPerformance: TJPEGPerformance;
property JPEGProgressiveDisplay: WordBool;
property JPEGQuality: TJPEGQualityRange;
property StoragePath: string;

Position

CurrentPosition and Duration return 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).

Codec information

property CodecName: WideString;

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;



Methods

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 (var CaptureFileName: String): WordBool;
Captures the current frame to a BMP file. 
- if FileName contains an empty string, the BMP file is saved using a file name automatically generated in the StoragePath directory according to the AutoFileName and AutoFilePrefix properties, 
- otherwise the BMP file is saved using the FileName value.

function CaptureFrameToJPEGFile (var CaptureFileName: String): WordBool;
- if FileName contains an empty string, the JPEG file is saved using a file name automatically generated in the StoragePath directory according to the AutoFileName and AutoFilePrefix properties, 
- otherwise the JPEG file is saved using the FileName value.

function CaptureFrameToImage (Image: TImage): WordBool;
The frame is saved to the TImage component. The TImage component must exist before calling this function.

function CaptureFrameToBitmap (Bitmap: TBitmap): WordBool;
The frame is saved to the TBitmap component. The TBitmap component must exist before calling this function.

procedure FGrabber_CaptureFrameTo (Dest: TFrameCaptureDest);
Note: this feature requires DirectX8, so it won't be available if a previous version of DirectX is installed on the platform where the application runs.
Captures 1 or several frames to a memory Bitmap, a BMP file or a JPEG file, according the the Dest parameter and the FGrabber_BurstMode, FGrabber_BurstCount and FGrabber_BurstInterval settings. 

The frame(s) is(are) returned by the OnFGrabberCaptureCompleted event according to the Dest value:

fc_TBitmap: only the TBitmap frame is returned by the OnFGrabberCaptureCompleted event,

fc_BmpFile or fc_JpegFile: the TBitmap frame is returned by the OnFGrabberCaptureCompleted event, and a BMP or JPEG file is created in the StoragePath directory according to the AutoFileName and AutoFilePrefix properties. 

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. The 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 GetMetaData (var ClipFileName, ClipTitle, ClipAuthor, ClipCopyright, ClipRating, ClipDescription, ClipLogoIcon: String): WordBool;
Retrieves the meta information.

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 play list.

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 PlayBackwards;
Starts playing a clip backwards from the starting position or continues playing backwards a paused clip.

procedure Previous;
Jumps to the previous clip in a play list.

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.



Public properties

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 play list 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 CodecName: WideString;
Retrieves the name of the codec used by the clip currently opened. The frame grabber must be enabled to get this information.

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 (play lists).

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 IsDirectX8Installed : WordBool;
The frame grabber requires DirectX8 to work. This property detects if DirectX8 or higher is installed on the current platform. 

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. 



Published properties

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 AutoFileName: TAutoFileName;
fn_Sequential: the file name is based on a sequential number, starting from 000001.
fn_DateTime: the file name is based on a date/time format, like yymmdd_hhmmss_zzz (zzz = milliseconds).

you can choose to force the file name of BMP and JPEG files created by the frame capture by specifying a file name when calling the FGrabber_CaptureFrameTo procedure. If the file name is left blank in FGrabber_CaptureFrameTo, a BMP or JPEG file name is generated automatically and returned by the OnFGrabberCaptureCompleted event.

property AutoFilePrefix: string
Sets or retrieves a prefix string placed at the beginning of a capture file name generated automatically. Especially used to distinguish  different serials of files when AutoFileName is set to fn_Sequential (e.g. when several TActiveMovie components are used in the same app and you want to generate separated serials of files for each component).

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, CaptureToJPEGFile, CaptureFrameToImage, CaptureFrameToBitmap and FGrabber_CaptureFrameTo.

property ClickToPlay: WordBool;
Specifies or retrieves a value indicating whether the user can toggle playback on and off by clicking the video image.

property Color: TColor;
Specifies or retrieves a value indicating the color of the background when ShowControls is disabled.

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 whether 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;
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 FGrabber_BurstCount: Integer;
Sets or retrieves the number of frames to capture when calling FGrabber_CaptureFrameTo.
Setting BurstCount to 0 and BurstInterval to 1 will grab ALL THE FRAMES when calling FGrabber_CaptureFrameTo.
This parameter is ignored when BurstMode is disabled.

property FGrabber_BurstInterval: integer;
Sets or retrieves the number of frames to skip between 2 captured frames. Set this value to 1 if you do not want to skip frames (E.g. BurstInterval = 20 means that 1 frame is grabbed every 20 frames).
This parameter is ignored when BurstMode is disabled.

property FGrabber_BurstMode: WordBool;
Enables or disables the capture of several frames by calling FGrabber_CaptureFrameTo.
If disabled, only 1 frame is grabbed when calling FGrabber_CaptureFrameTo.
If enabled, FGrabber_CaptureFrameTo starts grabbing frames according to the BurstCount and BurstInterval parameters.

property FGrabber_Enabled: WordBool;
Enables or disables the frame grabber. See also: Frame Grabber.

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 JPEGPerformance: TJPEGPerformance = (jpBestQuality, jpBestSpeed);
Controls the trade-off between color quality and speed of decompression of
JPEG files created by FGrabber_CaptureFrameTo.

property JPEGProgressiveDisplay: WordBool;
Use ProgressiveDisplay to turn on or off the incremental display of an image when reading in JPEG files created by FGrabber_CaptureFrameTo.

property JPEGQuality: TJPEGQualityRange = 1..100;
Use CompressionQuality to set the compression quality of a JPEG image created by FGrabber_CaptureFrameTo. Higher compression results in a poorer picture quality, but a smaller file size.

property Language: Integer;
Specifies or retrieves a value indicating the current locale used for national language support.

property Loop: WordBool;
If enabled, the clip restarts playing when the end of the stream is reached.

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 is 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 ScrollBarsThickness: integer;
Specifies or retrieves the thickness of the scrollbars, in pixels.

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. If enabled, the errors are not handled by the Windows Media Player, they are returned by the OnError event.

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 StoragePath: string;
Sets or retrieves the full qualified path where video captures and bmp snapshots will be stored. If left blank, the default storage path is the directory that contains the .exe file of the application. This property is not stored and can be changed only at runtime.

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 ImageSourceWidth: Integer;
Specifies or retrieves the width of the video border, in pixels.

property Visible: Boolean;
If disabled, audio clips or mp3 files can be played when the component is not visible. Still captures of media clips can be done, even if the clip is not visible.

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 value: 100.



Events

property OnF1HelpInvoked (Sender: TObject; var CanShowWMPHelp: Boolean);
Occurs when the Windows Media Player control has the focus and the F1 key is pressed. Set CanShowWMPHelp to false to disable the default Windows Media Player Help display when the user press the F1 key.

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 OnError  (Sender: TObject; ErrorCode: integer; ErrorMessage: string);
Occurs when the Windows Media Player control has an error condition. ErrorCode returns the Window Media Player error code. ErrorMessage returns the error message string in the platform's language. If SendErrorEvents is disabled, the errors are not returned by this event. They are directly handled by the Windows Media Player. 

property OnFGrabberCaptureCompleted (Sender: TObject; Bitmap: TBitmap; DestType: TFrameCaptureDest; FileName: string; Success: WordBool);
Occurs after a call to FGrabber_CaptureFrameTo when the frame is available as a memory TBitmap, a BMP file or a JPEG file, according to the DestType value, initially passed to the FGrabber_CaptureFrameTo procedure call. The file name automatically generated by TVideoGrabber in the StoragePath directory according to AutoFileName and AutoFilePrefix is returned by the event.
In all cases the frame is available as TBitmap in the Bitmap parameter.

property OnFullScreenKeyPress (Sender: TObject; Key: Word; Shift: TShiftState);
When the media is displayed in full screen mode, all the keyboard events are returned by this event. Key contains the key's code, and Shift the Alt | Ctrl | Shift state.

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.

 



Enumerated Types 

TAutoFileName = (fn_Sequential, fn_DateTime);    
See: AutoFileName.

TFrameCaptureDest = (fc_TBitmap, fc_BmpFile, fc_JpegFile);
See: FGrabber_CaptureFrameTo.

TDisplayMode = (mpTime, mpFrames);
See: DisplayMode

TDisplaySize = (mpDefaultSize, mpHalfSize, mpDoubleSize, mpFitToSize, mpCustomSize);
See: DisplaySize



Global Variables

- function IsMediaPlayerAvailable: Boolean;
Returns true if the Windows Media Player is installed on the current platform. 
Use this function to test the availability of the Media Player before dynamically creating the component.
E.g.:
procedure TForm1.Button1Click(Sender: TObject);
var
   AMovie: TActiveMovie;
begin
   if IsMediaPlayerAvailable then begin
      AMovie := TActiveMovie.Create (Self);
      AMovie.Left := 50;
      AMovie.Top := 50;
      AMovie.Parent := Self;
   end
   else begin
      ShowMessage ('The Windows Media Player is not installed on this platform.');
        ShowMessage ('Please download it from http://www.microsoft.com');
   end;
end;

var OleErrorDisplayMsg: String;
The message contained in this variable 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 platform.
         Please download it from http://www.microsoft.com

This message replaces the standard OLE Error display.  You can change it by the message of your choice. To display the default OLE error, simply assign an empty String to OleErrorDisplayMsg in the initialization section of the Form unit containing the TActiveMovie component.

 


 


 

FAQ - HowTo



FAQ

Q: Is the Microsoft's Windows Media Player installed by default on all 32 bits Windows platforms?

A: The Windows Media Player v6.4 or higher is installed by default starting from Windows 98 Second Edition. 
For Windows 95 and Windows 98 1st Edition, it can be freely downloaded and installed from the Microsoft's web site.

Q: I loaded up the demo for TActiveMovie in Delphi 6 Trial and tried to build it.
I am getting the following error: Access violation at address 009807e7 in module dcc60.dll read of address 000E9c6.

A: The trial version comes with a different DCU format than the real one. You
can't use it or other third party components in the trial.


Q: I am using Delphi4. When starting a video from the IDE, sometimes Delphi reports thread errors.

A: 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
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. 


Q: I get an error when opening mpeg clips. Nothing is displayed.

A: 2 possibilities:

1. the codec required by your clip is not installed on your platform. To check that, try to open the clip with the Windows Media Player.
- if the media player reports an error, try to find and install the required codec.
- if the media player downloads and install automatically the codec, and then, plays the clip, try again to open the clip with TActiveMovie. 

2. errors when opening clips are often caused by bugs in third-party codecs. Try to open the clip in the Windows Media Player. If the clip don't work in the WMP as well, and you have additional(s) codec(s) installed, remove it(them) and try again.



HOW TO

Automatically play the next movie as soon as the previous ends

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;

 

play mp3 files without visible player

- the first trick is to use a non-visible form... 

but the form must be visible for the player to play!

- so, the second trick is to put the form out of the screen with a "zero" size:

procedure TForm1.Button1Click(Sender: TObject);
var
    NonVisibleParent: TForm;
    ActiveMovie: TActiveMovie;
begin
    NonVisibleParent := TForm.Create (Self);
    NonVisibleParent.SetBounds (- 100, - 100, 0, 0);
    NonVisibleParent.Visible := True;

    ActiveMovie := TActiveMovie.Create (NonVisibleParent);
    ActiveMovie.Parent := NonVisibleParent;
    ActiveMovie.FileName := 'yourfile.mp3';
    ActiveMovie.OpenSync;
    ActiveMovie.Play;
end;

KNOWN ISSUES

Access violation "Read of address FFFFFFFF" on exit when the ShowStatusBar property is enabled from the Object Inspector 

This is a bug of the current version. To avoid it, enable the ShowStatusBar programmatically at runtime:

- let the ShowStatusBar property disabled in the Object Inspector,

add the following statement in the OnCreate event of your TActiveMovie's form:
ActiveMovie1.ShowStatusBar := true;

 


Description - Features - Registration

TActiveMovie is a VCL component for Delphi or C++ Builder.

TActiveMovie allows you to embed the Microsoft's Media Player within your project.

With TActiveMovie you can zoom in, zoom out, scroll horizontally and vertically, display videos in full screen mode. 

You can play clips forwards, backwards, capture frames individually or automatically to TBitmap, TImage, BMP or JPEG files. 

You can adjust the sound volume, speed rate, select the start and end positions of video clips.

TActiveMovie saves you having to tangle with ActiveX and COM interfaces. Most common parameters can be simply set from the Object Inspector.

Benefits

  • works on all 32 bits Windows  platforms, from Windows 95 to Windows XP

  • video quality, fluidity of the motion

  • plays video clips as well as audio mp3 and wav files

System requirements

  • Delphi 3, 4, 5, 6, 7  or   C++Builder 4, 5, 6

  • Windows 95/98/NT/ME/2000/XP

  • Windows Media Player v6.4 or higher

 

REGISTRATION

Click here to register.

 


License Agreement

 

Copyright

All Datastead Software components and applications are copyrighted by Michel FORNENGO (hereafter "author"), and shall remain the exclusive property of the author.

General agreement

By installing this software you agree with:

- You may not use the source code or binaries in this package to create competitive software product,
- You may not manipulate any binary files included or generated by Delphi/C++Builder using the package,
- You may not distribute source code or registered version to non registered people.

Registered versions license statement

This software and any accompanying documentation are protected by United States copyright law and by International Treaty provisions.

Any use of this software in violation of copyright law or the terms of this agreement will be prosecuted to the best of the author's ability.

You are hereby authorized to make archival copies of this software for the sole purpose of back-up and protecting your investment from loss.

Under no circumstances may you copy this software or documentation for the purposes of distribution to others. Under no conditions may you remove the copyright notices made part of the software or documentation.

Distribution Rights

You are granted a non-exclusive, royalty-free right to produce and distribute executable binary files (executables, DLLs, etc.) that are built with the registered version of the software unless specifically stated otherwise.

Restrictions

Without the express prior written consent of the author, you may not distribute any of the author's commercial source code, compiled units or documentation by any means whatsoever. You may not transfer, lease, lend, copy, modify, translate, sublicense, time-share, or electronically transmit or receive the software or documentation.

Upgrade

The upgrade version of the software constitutes a single product of the author's software that you upgraded. For example, the upgrade and the software that you upgraded cannot both be available for use by two different people at the same time, without written permission from the author.

Disclaimer

The Author cannot and does not warrant that any functions contained in the Software will meet your requirements, or that its operations will be error free. The entire risk as to the Software performance or quality, or both, is solely with the user and not the Author. You assume responsibility for the selection of the component to achieve your intended results, and for the installation, use, and results obtained from the Software.

The Author makes no warranty, either implied or expressed, including without limitation any warranty with respect to this Software documented here, its quality, performance, or fitness for a particular purpose. In no event shall the Author be liable to you for damages, whether direct or indirect, incidental, special, or consequential arising out the use of or any defect in the Software, even if the Author has been advised of the possibility of such damages, or for any claim by any other party.

All other warranties of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose, are expressly excluded.

General

This Agreement is the complete statement of the Agreement between the parties on the subject matter, and merges and supersedes all other or prior understandings, order orders, agreements and arrangements. This Agreement shall be governed by the laws of France. Exclusive jurisdiction and venue for all matters relating to this Agreement shall be in courts and fora located in France, and you consent to such jurisdiction and venue. There are no third party beneficiaries of any promises, obligations or representations made by Datastead.