Solved

Real Audio ocx

Posted on 2003-11-04
19
520 Views
Last Modified: 2013-11-17
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,

Thanx

Byte Me.
0
Comment
Question by:byte_me
  • 6
  • 6
  • 3
  • +1
19 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9678503
That ocx plays in sync or async?
If play in sync, just call play method for each file in the list.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9678512
Or maybe it accepts comma separated parameters, just a guess.
What it wants when ask you for parameters?
0
 

Author Comment

by:byte_me
ID: 9678545
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
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9678706
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
0
 

Author Comment

by:byte_me
ID: 9679251
Richie,

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
0
 
LVL 4

Expert Comment

by:PBuck
ID: 9679313
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
0
 

Author Comment

by:byte_me
ID: 9679364
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
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9679505
If it accept an url, maybe you could use:

realocx.source = "c:\mymusic"
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 4

Expert Comment

by:PBuck
ID: 9679559
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.
0
 

Author Comment

by:byte_me
ID: 9679618
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
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9680051
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)
0
 

Author Comment

by:byte_me
ID: 9680183
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!!!!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9680248
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.
0
 

Expert Comment

by:p_hip
ID: 9689864
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 ?
0
 

Expert Comment

by:p_hip
ID: 9690225
Is Real Player the same thing as Real Audio - because Real Player seems to do Playlists in a similar way as the MS MediaPlayer.
0
 

Author Comment

by:byte_me
ID: 9693138
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.  

0
 

Accepted Solution

by:
p_hip earned 75 total points
ID: 9696148
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">
      <Entry>  
            <Ref HREF="file://C:\Program Files\Windows NT\Pinball\SOUND1.WAV" />
      </Entry>

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

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

</ASX>

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 objMedia.open("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)

<smil>
  <head></head>

  <body>

    <seq>
      <audio src="file:///c:/audio/first.rm"/>
      <audio src="../audio2.ra"/>
     
      <par>
        <img src="http://www.example.org/logo.gif"/>
        <textstream src="rtext.rt"/>
        <video src="video1.rm"/>
        <audio src="audio3.ra" dur="2s"/>
      </par>
    </seq>

  </body>

</smil>

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,
Paul.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IT Asset Management 5 67
Access query that references subform 5 43
JItbit AD intergration 4 74
Denali Software 2 44
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
If your app took Google’s lash recently, here are the 5 most likely reasons.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now