Real Audio ocx

Hi there,

Im using the Real audio ocx to play .ra and mp3 files in a VB6 application.  I want to create a simple playlist where i can get the control to play a number of media files one after the other... im a bit stuck, theres not much by the way of documentaion for this control.  does anybody know how to do this?

your help is much appreciated,


Byte Me.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richie_SimonettiIT OperationsCommented:
That ocx plays in sync or async?
If play in sync, just call play method for each file in the list.
Richie_SimonettiIT OperationsCommented:
Or maybe it accepts comma separated parameters, just a guess.
What it wants when ask you for parameters?
byte_meAuthor Commented:
Thanks for replying Richie,

Ive tried the comms, it didn't like that! well im not sre if its sunc or async, i think it sync. i can call the play method for the next media track, but what i want to do is play the next trach automatically when the current track finishes.  I can write a simple routine that watches out for the end position of every track and then get it to call nthe play method on the next track, but i wondared if there was an easier way to do it.

Byte Me
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Richie_SimonettiIT OperationsCommented:
What i think is:
'If ocx plays in sync then:

with myrealocxcontrol
         .play "C:\music\song1.ra"
         ' since it is in sync, it doesn't returns to next line of code until song has finished, am i right?
         .play "C:\music\song2.ra"
         ' since it is in sync, it doesn't returns to next line of code until song has finished
         .play "C:\music\song3.ra"
          ' since it is in sync, it doesn't returns to next line of code until song has finished
         .play "C:\music\song4.ra"
end with
byte_meAuthor Commented:

Well i think that this guy is an async control.  as soon as the .DoPlay method has ben called it does go to the next line of code, ive got it reading track lengths and so on.

Byte Me
I assume the .DoPlay is the method for actually playing the loaded song?  So you must have some sort of .Filename property?

Richie may have hit it earlier by suggesting a delimted filename property value?

.FileName = "song1.mp3,song2.mp3,song3.mp3"
.DoPlay = True
byte_meAuthor Commented:
Hi again,

there is a .source propery which is the filename or the URL to be loaded. but the source property does not like more than one filename assigned to it... if you do it just does nothing!  the only way i can think of is to write some code that looks out for when the current track ends and then sets the source property to the path of the next track, and then calls the .DoPlay method. i cant find a simpler way of doing this..

Byte Me
Richie_SimonettiIT OperationsCommented:
If it accept an url, maybe you could use:

realocx.source = "c:\mymusic"
Wow ... ByteMe you were not kidding about NOT being able to find much info about this via the net!  

I found only one sample using the RMOC3260.DLL (this the same control)?  The sample only allowed one file.
byte_meAuthor Commented:
hi Richie,

Thanx for helping out, i've tried the URL method aswell, it still don't want to know!!!!!!!! i think this control is written such that it can only play one file at a time. the funny thing is if you use the object browser in VB, there are some methods accociated with playlists, but none of them want to work!!!! also, the OnPositionChange event doesn't fire-up either when the track position changes. I've strip searched the internet for documentaion..... you know what i found!

Byte Me
Richie_SimonettiIT OperationsCommented:
is there actually a playlist property? ( i did trying downloading the real player but when i go to add the ocx to a form i got an error)
byte_meAuthor Commented:
no, there is no playlist property, but there are a few properties that refer to a playlist... man im really begining to hate this ocx!!!!
Richie_SimonettiIT OperationsCommented:
Maybe playlist is a text file (lkike winamp: m3u file) and it should be a place to tell to this ocx how is the name of that list.
Don't know how to do it with Real Audio - but I do know how to do it with the Windows Media Player - would this be any help ?
Is Real Player the same thing as Real Audio - because Real Player seems to do Playlists in a similar way as the MS MediaPlayer.
byte_meAuthor Commented:
Hi there,

sorry for not getting round to replying, i've been away.

Richie: im not sure if the plylist is a text file, I'll look into that!!
I could use the windows media player but ir doesn't play Real media files, i could use it to pay the mp3 files though.  

WindowsMedia first:
The playlist is stored in a ".asx" file and consists of HTML-like tags.  An example of which is:

<ASX Version = "3.0">
            <Ref HREF="file://C:\Program Files\Windows NT\Pinball\SOUND1.WAV" />

            <Ref HREF="file://C:\Program Files\Windows NT\Pinball\SOUND181.WAV" />

            <Ref HREF="file://C:\Program Files\Windows NT\Pinball\SOUND1.WAV" />
            <Duration value="00:00:02"/>


Although I've specified local files, they could of course been Networked files or URLs (the format of the HREF for both is slightly different).
Drop the MediaPlayer control onto a form (msdxm.oca - let's call the control objMedia).  In the form load do "Call"c:\try.asx")" - or wherever you have the asx file and run the form.  The playlist should be run straight through. When the play back of the playlist has finised it will fire objMedia_PlayStateChange event with a NewState of mpStopped.  There is presumably an event when transitioning between playlist items - but I haven't needed to do this so haven't looked.

Now RealPlayer:
This uses a ".smi" file - the tags are different, but has the same concepts (the head block is required, but doesn't need anything within)



      <audio src="file:///c:/audio/first.rm"/>
      <audio src="../audio2.ra"/>
        <img src=""/>
        <textstream src="rtext.rt"/>
        <video src="video1.rm"/>
        <audio src="audio3.ra" dur="2s"/>



This will play three jobs in sequence, the last of which has 4 tasks to be started at the same time.  You can also put a duration in the 'par' tag such as <par dur="30s">  which will play the block for a maximum of 30 secs.

I don't have the ocx for the RealPlayer, but if it does have an "open" method then go for that.

More info on .asx content is available from MSDN, info for the .smi file can be got from W3C or off the Real site.

Hope this helps,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.