Play media files

  • Thread starter Thread starter Kevin
  • Start date Start date
Kevin,

Reproduce? Or play, as the title suggests? If you want to play a file,
just embed Windows Media Player in your app.
 
Hi!
What is the best way to reproduce media files (mp3, wav, wma, wmv, etc)?

"Best" is extremely subjective. However, _a_ way to do it is to use
the AudioVideoPlayback class in the managed DirectX library.

Just add the necessary reference to your project, create an instance of
the AudioVideoPlayback class, and you're good to go. It will create an
ActiveMovie playback window for video playback (I forget if there's a
way to set an existing window as the render target...there might be).

Pete
 
Just to elaborate, I believe that AudioVideoPlayback is a namespace (the
full namespace being the Microsoft.DirectX.AudioVideoPlayback namespace).

The OP should be able to create an instance of the Video class in that
namespace and then set the Owner property to the control that should play
the video.
 
"Best" is extremely subjective. However, _a_ way to do it is to use the
AudioVideoPlayback class in the managed DirectX library.

Just add the necessary reference to your project, create an instance of
the AudioVideoPlayback class, and you're good to go. It will create an
ActiveMovie playback window for video playback (I forget if there's a way
to set an existing window as the render target...there might be).

cool ... thanks for posting that, Peter ...

let me flesh it out a bit for those (like me) who didn't immediately get how
to make it work:

-- add the reference to Microsoft.DirectX
-- (C:\WINDOWS\Microsoft.NET\DirectX for Managed
Code\1.0.2902.0\Microsoft.DirectX.dll)
-- add the reference to Microsoft.DirectX.AudioVideoPlayback
-- (C:\WINDOWS\Microsoft.NET\DirectX for Managed
Code\1.0.2902.0\Microsoft.DirectX.AudioVideoPlayback.dll)


// using Microsoft.DirectX;
using Microsoft.DirectX.AudioVideoPlayback;

// video
string movie = @"c:\GoneWithTheWind.mpeg";
Video av = new Video(movie);
av.Owner = panel1; // can be ANY Windows.Forms control; Button works, eg
av.Play();


// audio
string song = @"c:\SongForYou.mp3";
Audio au = new Audio(song);
au.Volume = -100; // amt of volume attenuation (-)
au.Play();
 
[...]
let me flesh it out a bit for those (like me) who didn't immediately get how
to make it work:

Thanks. Sorry, it's been awhile since I used it and all of that was
off the top of my head. Thankfully between you and Nicholas I think we
have a much more complete answer now. Much obliged. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top