Embedding windows media / real player / quicktime in delphi 7 application

I would like to embed the 3 main media players in my D7 app.   I have NO experiance with this and while i've heard its easy I would like some assistance.

If possible i would love code samples / instructions for all 3 but a simple walkthrough will do :)
Who is Participating?
BJThomsenConnect With a Mentor Commented:
For the Windows Media player at least you can import the active X control into delphi.

Goto the Component/Import Active X and select the Windows Media Player. This will let you place a TWindowsMediaPlayer on your form. It's possible you could do the same for RM and QT.
TheRealLokiSenior DeveloperCommented:

or, if you can't read that, it's like this

First, I create an RC project with NOTEPAD.EXE and ARJ.EXE in it as follows (we'll call it RESJUNK.RC):

then I compile it with BRCC32 into a RES file. After this I include it in my Delphi project by using the $R compiler directive like this:

and extract this files by using the TResourceStream class.

      procedure ExtractRes(ResType, ResName, ResNewName : String);
         Res : TResourceStream;
         Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
hibbidijiAuthor Commented:
I'm horrifically confused.  I've never made an RC project. I will start it and see what I can figure out, but can you make an example that uses windows media player?
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I wonder what you mean by - "embed the 3 main media players in my D7 app" - what is Embed mean for you? ? I can not figure embed?

To just have 3 TMediaPlayers, you click the TMediaPlayer button and then click your form where you want them, three times

procedure TForm1.but_PlayClick(Sender: TObject);
MediaPlayer1.FileName := 'C:\Song1.mp3';
You want to play these files from ur application?
Play an mp3 ?  Or just embed them inside the app and extract them somewhere?

1.) Go to this directory:

C:\Program Files\Borland\Delphi7\Bin
Copy the file Brcc32.exe to the directory of ur application.

2.) Here is a guide with all the info you need.

3.) As mentioned above u create a txt file, rename the extension to ".rc" and then open command window
(Start-Run-Cmd) and execute brcc32 like this :

"Brcc32 YourFile.Rc"

4.) In YourFile.Rc (the txt file...) you should type this :

Resource name, resource type, resource file name with the path
Mypicture    IMAGE  "C:\My Delphi Programs\Test1\Mypicture.bmp"

This is for an image file.  IMAGE = Resource type.
To see the several Resource types just go to delphi help and type ResType.

Another example of what u shoul type in the txt before renaming it to Something.Rc :

Clock WAVE "c:\mysounds\projects\clock.wav"
MailBeep WAVE "c:\windows\media\newmail.wav"
Cool AVI cool.avi
Intro RCDATA introsong.mp3

5.) When u execute brcc32, "Brcc32 YourFile.rc"
a file will be created ----> YourFile.RES

6.) Write this :         {$R YourFile.RES}
exactly under implementation under
{$R *.dfm}

7.) Like this :

{$R *.dfm}
{$R YourFile.RES}

Inside the link i gave u, u'll find everything u need

Hope this will help u :)

TheRealLokiSenior DeveloperCommented:
Windows Media Player has an awful lot of baggage (dll's codecs, etc)
it is after all, several meg as an install from microsoft, and you will need to make sure you have it for the correct OS
but if you still want to do this, for a start your RC would look like this
MPlayer EXEFILE "C:\Program Files\Windows Media Player\mplayer2.exe"

then you'll need to find all the dlls and codecs
hibbidijiAuthor Commented:
I think everyone is missing the point.  the title of the question referes to windows media player, real player and quicktime,  Slick,
imagine a web page with an embedded windows media player.  the browser is using the ocx in at least internet explorer's case.     I'm writing an application that will play windows media (including DRMd files), quicktime and real player files inside it.   In visual basic its quite easy to do this, practically drag and drop.     I also do not intend on distrobuting the files with the application.   to begin, its illegal, against all the TOSs that accompany these apps.  I will require that the user install the apps they want to access.  

Is there not an easy way to embed activex or somesuch in delphi?
TheRealLokiSenior DeveloperCommented:
just drop a TMediaPlayer component (system tab) onto the form Not sure about real or quicktime files though.
U said embed those applications.
Thats why i was confused.
There is no need to embed the applications to play those files.

Just google and search for components.

This is the code for playing wma and mp3 like Slick812 said:

 MediaPlayer1.FileName:=the file name;

hibbidijiAuthor Commented:
you're saying that playing a real player streaming video stream is possible using the code above?  
This is the code for playing " wma and mp3 ".
Like i said there is no need to embed the applications to play those files.
Just google and search for components....
This will simplify ur code.

Yes u can play real player streaming video if u embed all the application with the code i gave you using RCData as a type
then extract in runtime and give the order to the app extracted to play a file that user wants.
BUT this will make the application size huge.
However with delphi u can use windows api so you can play wma and mp3 without embeding anything.

The only solution, is using a component.

I am almost certain that if you just import the Real player .EXE program it will not run on a puter that does not have that version installed (needs supporting DLLs and support files), and if it is already installed, why store it as a resource?
I have been able to use the TMediaPlayer for any files that I needed to play, but it is true that there are a few media files that it will not play?
This is just my "Idea" about doing this type of thing, I have not tried to do this for any type of Media Player,
On the Delphi IDE menu bar, go to the Component menu and then click the "Import ActiveX Control" Im mine there is a  "Windows Media Player" and there is also a  "Real Player ActiveX Library", you can choose one (you may see other ActiveX that you are interested in) and then click the "Add" button, this should place that imported ActiveX control in the ActiveX Tab of the component library, you can then click That activeX onto your Form and look in the object inspector for the properties and events that it supports, , , do not ask me about how to use these ActiveX controls, because I have not used them. . . For some activeX I have imported the properties and method names are enough for me to start to use them, , ,  I am not sure if this is what you mean? just an Idea, maybe there are better ways?
It is posible to start and existing program (Like NotePad) and set it as a "Child Control" so it appears On your Form, but it is a tough thing to then "Control" this program from your apps code, unless there is a "COM" link or DDE you can use to control it, I think that Windows media player has a Com link (or some Kind of control connection), but I am not familar with it
I think that the decoding of Rm (Real media) and Mov (Quicktime) video streams is a protected code.
Its not an open source. Thats why no player can play those files...
So thats why i think the only way to play those files is to insert a component (not freeware) that pays money to
Real and Quicktime.
you didnt tell us, why you want to have the three players in your programm,
but if you want the user to play his own files then you'll get a whole new
dimension to the problem.
if the video is divx then it can have the extension avi and the user wont be
able to play it in your program. and there are enough systems out there
that have problems with playing videos because of wrong or missing
or otherwise not working codecs.
especially with divx there is a whole bunch of codecs running around
but there are also enough avi codecs that take their share into the problem.
hibbidijiAuthor Commented:
I have found an appliation that appears to do what I want:


They have done the same thing.   Someone on a message board where I posted this question as well pointed it out.  

I also want to use it for vaguely similar reasons
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.