BW Media OCX 1.5.1 - Documentation

Last modified on 31 , January  2001 - 17:51 PM , BinaryWork Corp.

More information , new releases and any other additional info about this software can be found at http://www.binarywork.net/bwmedia.htm


Functions

Sub AboutBox()
Member of BWMedia150b.BWMedia
to show a about box

Function AddExtensionToMediaPlayer(ExtensionToAdd As String, Definition As String) As Boolean
Member of BWMedia150b.BWMedia
This function will define the extension and media type that the Media player will load and play

This function will add the extension and definition to the system

Then when a file with the selected extension is loaded in the Media OCX , it will load the correct driver

The valid values for the Definition variable are :

MPEGVideo2 - To play video and mpg files compressed with new methods
MPEGVideo - To play normal mpg files and others videos
AVIVideo - To play avi files
waveaudio - To play wav files
Sequencer - To play mid files

Notice that in order to the control to play the new Microsoft Media format you need to have the latest Media player installed in the system
And you need to set the Definition variable to MPEGVideo , and it will not work if you select MPEGVideo2 or any other media definition

Example : if you have a wmv media file , and you want to rename the extension to .mfl , then you need to call the AddExtensionToMediaPlayer function with the following data:
BWMedia1.AddExtensionToMediaPlayer "mfl", "MPEGVideo"
It will add to the system the extension .mfl as a video or audio media file , and when this file is loaded by the Media OCX it will be played without problems ( if you already have the new codecs required by wma and wmv media files ) 

Future versions of this control will select the media codec based in the header of the media file , then you only need to pass the file with any extension to the control and the control will be able to select the correct driver to the media file automatically

To remove a extension just pass an empty string to the Definition variable

Function CanPlayInReverseMode() As Boolean
Member of BWMedia150b.BWMedia
To verify whether the media can play in reverse mode


The reverse playback mode is only available when playing AVI files


Function CanRecord() As Boolean
Member of BWMedia150b.BWMedia
Funtion to verify whether the loaded media file has record capabilities

Function CanSave() As Boolean
Member of BWMedia150b.BWMedia
Funtion to verify whether the loaded media file has save capabilities

Function CanSetVolume() As Boolean
Member of BWMedia150b.BWMedia
To verify whether the internal volume control can be handled

Event Click(Button As Integer)
Member of BWMedia150b.BWMedia
This event is raised in any mouse click over the control , button 1 is the left mouse button , and button 2 is the right mouse button

Sub CloseMedia()
Member of BWMedia150b.BWMedia
Function to close the media file (modified in the version 1.4.0)

Sub ControlFreq(TimerRefresh As Long)
Member of BWMedia150b.BWMedia
to set the refresh of the control , the default value is 1000 ( one second )

Function ControlName() As String
Member of BWMedia150b.BWMedia
It will retrieve the product name of the control

Function DebugFunction(DebugInformation As String, ReturnInformation As String) As Long
Member of BWMedia150b.BWMedia
Debug function (only used internally during the development of the control )

Function DeviceDescription() As String
Member of BWMedia150b.BWMedia
It will return what is the internal driver or codec that is being used to play the selected media file

Function DeviceID() As Long
Member of BWMedia150b.BWMedia
It will return the DeviceID of the control , can be used to select sound cards if more than a sound card is installed

Function DeviceIdentifier() As String
Member of BWMedia150b.BWMedia
It will retrieve the name of the device in the registry being used to play the media file

Function DeviceType() As String
Member of BWMedia150b.BWMedia
It will return the MCI device type being used to play the selected media file

Function DriverVersion() As String
Member of BWMedia150b.BWMedia
It will retrieve the version of the driver that is being used to play the selected media file

Event Finished()
Member of BWMedia150b.BWMedia
Raised in the end of the playback , notice that this event will only be raised in the end of the playback of the entire media file , and not when loading another media or when stopped or paused (modified in the version 1.4.0)

Function GetMediaLength() As Long
Member of BWMedia150b.BWMedia
Function to retrieve the length of the loaded media file

Function GetMixerDevices(DeviceName() As String, DeviceIDNumber() As Long, SupportedFormats() As String, Manufacturer() As String) As Boolean
Member of BWMedia150b.BWMedia
This function will retrieve in the arrays the information about the intrinsics of the defined sound card driver

Function GetNumberOfSoundCardMixers() As Long
Member of BWMedia150b.BWMedia
This function will retrieve the number of soundcards installed in the system

Function HasASoundCardInstalled() As Boolean
Member of BWMedia150b.BWMedia
This function will retrieve the presence of at least one sound card installed , if yes , then it will return true

Event MCIError(Errorcode As Long, ErrorcodeDescription As String)
Member of BWMedia150b.BWMedia
This event is raised in any error regarding the MCI commands , and it will return the error code and the error description also

Function MediaDelete(FileToSave As String, StartPosition As Long, EndPosition As Long) As Boolean
Member of BWMedia150b.BWMedia
Function to delete portions of the media file ( can be used only on wav files )

Sub Mediafile(Midi As String, loopMe As Boolean, [PlayNow As Boolean], [SeekToZeroAtTheEndOfPlayback As Boolean = False])
Member of BWMedia150b.BWMedia
define the file to playback , and the arguments required to play the media file (modified in the version 1.4.0)

Event MediaLength(LengthString As String, LengthLong As Long, Frames As Long)
Member of BWMedia150b.BWMedia
The length of the media file , and if frames is selected , then it will return the number of frames in the media file

Property MediaLengthLong As Long
Member of BWMedia150b.BWMedia
Return the length of the media file , or the frames if the media support frames

Event MediaPosition(TimeLength As String, Length As Long, FramesPosition As Long)
Member of BWMedia150b.BWMedia
Return the position of the playback or the frame position if the media file support frames

Property MediaPositionLong As Long
Member of BWMedia150b.BWMedia
Return the position of the playback as long , and it will return the frames position if the media file support frames

Function MediaRecord(FileToSave As String, StartPosition As Long, EndPosition As Long) As Boolean
Member of BWMedia150b.BWMedia
Function to record and save portions of the media file ( can be used only on wav files )

Sub MediaSpeed(speed As Long)
Member of BWMedia150b.BWMedia
to define the playback speed of movies

Sub MidiTempo(Mytempo As Long)
Member of BWMedia150b.BWMedia
to define the speed of the playback of midi files

Event Modechanged(Mymode As String)
Member of BWMedia150b.BWMedia
event to monitor the status mode of the control

Sub PauseMedia()
Member of BWMedia150b.BWMedia
to pause the playback

Sub Play([WaitUntilTheEndOfThePlayback As Boolean], [StartPosition As Long])
Member of BWMedia150b.BWMedia
to play the actual media file (modified in the version 1.4.0)

Property PlaybackBar As Boolean
Member of BWMedia150b.BWMedia
to define if the playbar is visible or not

Property PlaybackDevice As String
Member of BWMedia150b.BWMedia
This property will get the default playback device in the control panel , multimedia setting

Sub PlayReverse(Fullscreen As Boolean)
Member of BWMedia150b.BWMedia
to play avi files in reverse mode ( cannot be applied to all movie files , see the CanPlayReverse function to verify whether the media can play in reverse mode)

Event Resize()
Member of BWMedia150b.BWMedia
Raised when the control is resized

Sub ResizeControl()
Member of BWMedia150b.BWMedia
function to force the rezise of the control

Sub ResizeWindow(ScaleZoom As Long)
Member of BWMedia150b.BWMedia
to force the resize of the window to fit the movie with the especific percent of the image

Sub ResumeMedia()
Member of BWMedia150b.BWMedia
to resume the playback

Event ReturnError(Errorcode As Long, ErrorDescription As String)
Member of BWMedia150b.BWMedia
This event will return the errors in the control

Event ReturnMixersInfo(MixerName As String, MixerNumber As Long, ClearListViewFlag As Boolean)
Member of BWMedia150b.BWMedia
This event will return the informations regarding the system mixers installeds

Sub SeekTo(Myseek As Long)
Member of BWMedia150b.BWMedia
to change the playback position of the media media

Event SetWaveOutLevel(NewValue As Long)
Member of BWMedia150b.BWMedia
This event will update a progressbar with the wave out level ( if the sound card support this feature )

Function ShowOpenFilePreview(Hwnd As Long, Filter As String, HasPreview As Boolean) As String
Member of BWMedia150b.BWMedia
This function will show the Open Dialog to select the mediafile to playback , and in the version 1.5.0 and above you can select whether a preview window will appear or not


'  This is a sample code

Dim Filename As String
Dim Filter As String
Filter = "Multimedia files (*.mid;*.wav;*.mpg;*.mp3;*.avi;*.mov) " & Chr(0) & "*.mid;*.wav;*.mpg;*.mp3;*.avi;*.mov" & Chr(0) & "Midi files (*.mid) " & Chr(0) & "*.mid" & Chr(0) & Chr(0)

Dim HasPreview As Boolean 'It will keep the value to the preview mode of the ShowOpenFilePreview function

If Check5.Value = 1 Then  'in this case Check5 will define whether the preview will appear or not

'It will enable or not the preview mode in the ShowOpenFilePreview dialog box
'Notice that the preview option will be available only on win95, Win98 and future versions of windows 95 , and not in Winnt 4.0 or Windows 2000
'If enabled in not supported OS , the preview window beside the dialogbox will not appear

HasPreview = True

Else

HasPreview = False

End If

'Set the HasPreview to false to dont show the Mutimedia preview window when openning the multimedia files

'Notice that the preview mode don't work on Winnt 4.0

Filename = BWMedia1.ShowOpenFilePreview(Form1.hWnd, Filter, HasPreview) 

'Now the Filename variable has the selected file


Sub StopMedia()
Member of BWMedia150b.BWMedia
to stop completely the playback (modified in the version 1.4.0)

Property TimeFormat As Boolean
Member of BWMedia150b.BWMedia
To set/return the method that the control will handle the length of the media file , as miliseconds or frames

Event UpdateVolumeControl(NewValue As Long)
Member of BWMedia150b.BWMedia
Event raised in any change of the internal volume control

Property UseOnlyPreferredDevice As Boolean
Member of BWMedia150b.BWMedia
This property will get and set the "Use only preferred device" value in the control panel , multimedia setting

Property VolumeControl As Long
Member of BWMedia150b.BWMedia
Function to return/set the internal volume control

Property VUMeterAvailable As Boolean
read-only
Member of BWMedia150b.BWMedia
This function will return whether the soundcard has the ability to show the wave out in a progressbar

Public Function GetWindowhwnd() As Long
Member of BWMedia151b.BWMedia
This function will retrieve the handle of the usercontrol window

Public Function GetMCIhwnd() As Long
Member of BWMedia151b.BWMedia
This function will retrieve the handle of the MCI window

Public Sub CloseResources()
Member of BWMedia151b.BWMedia
This sub will send a command to release all the allocated resources used by the MCI window

( This sub is a starting point to fix some known problems that occurs when playing files using the Microsoft MCI commands , and it will be enhanced in future versions )

Public Function MediaShowCursor(ShowWindow As Boolean) As Boolean
Member of BWMedia151b.BWMedia
This function will hide or show the cursor , use it to avoid the presence of the cursor during the playback of movies in fullscreen mode

Public Property PlayerStatus As Long
read-only
Member of BWMedia151b.BWMedia
This property will retrieve the actual status of the control


--------------------------------------------------------------------------------

BinaryWork Corp.
