473,800 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Play media files

Hi!
What is the best way to reproduce media files (mp3, wav, wma, wmv, etc)?

Thanks =)
Nov 28 '07 #1
4 8061
On 2007-11-27 18:26:03 -0800, "Kevin" <a@a.comsaid:
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 AudioVideoPlayb ack class in the managed DirectX library.

Just add the necessary reference to your project, create an instance of
the AudioVideoPlayb ack 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

Nov 28 '07 #2
Just to elaborate, I believe that AudioVideoPlayb ack is a namespace (the
full namespace being the Microsoft.Direc tX.AudioVideoPl ayback 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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Peter Duniho" <Np*********@Nn OwSlPiAnMk.comw rote in message
news:2007112718 564477923-NpOeStPeAdM@NnO wSlPiAnMkcom...
On 2007-11-27 18:26:03 -0800, "Kevin" <a@a.comsaid:
>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
AudioVideoPlayb ack class in the managed DirectX library.

Just add the necessary reference to your project, create an instance of
the AudioVideoPlayb ack 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
Nov 28 '07 #3
Liz

"Peter Duniho" <Np*********@Nn OwSlPiAnMk.comw rote in message
news:2007112718 564477923-NpOeStPeAdM@NnO wSlPiAnMkcom...
>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
AudioVideoPlayb ack class in the managed DirectX library.

Just add the necessary reference to your project, create an instance of
the AudioVideoPlayb ack 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.Direc tX
-- (C:\WINDOWS\Mic rosoft.NET\Dire ctX for Managed
Code\1.0.2902.0 \Microsoft.Dire ctX.dll)
-- add the reference to Microsoft.Direc tX.AudioVideoPl ayback
-- (C:\WINDOWS\Mic rosoft.NET\Dire ctX for Managed
Code\1.0.2902.0 \Microsoft.Dire ctX.AudioVideoP layback.dll)
// using Microsoft.Direc tX;
using Microsoft.Direc tX.AudioVideoPl ayback;

// video
string movie = @"c:\GoneWithTh eWind.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();
Nov 28 '07 #4
On 2007-11-27 20:46:10 -0800, "Liz" <li*@tiredofspa m.comsaid:
[...]
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. :)

Nov 28 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
2570
by: The Road To Utopia | last post by:
Here's one for the trolls...a common jibe from them is setting up audio/video hardware under linux. Ok, true story: at work today, someone asked me if I could tell him why his XP Home would play the video from a DVD but not the audio. He had been searching for an answer for days on support.microsoft.com but found none. I suggested Google and Gateway. Gateway had nothing, but sure enough, search for *XP DVD no sound* on Google and...
0
2331
by: charbonneau | last post by:
I need to develop a WinForm application which can play .mp3 music files stored on another machine on a LAN. This applicaiton needs to run on servaral different client machines at the same time. I want to have complete control over the UI - no visibly embedded Media Player if possible. I also need to be able to programatically stop/play/pause/resume/change volume/change songs. Any ideas on how to do this? Do I need some sort of...
22
3770
by: MLH | last post by:
I have some audio help files that play fine from within Access 97 and Access 2.0. Both are running on a Windows XP box. But I do not know what program plays the files. If I click Start, Run and type in c:\MyApp\MyHelp\Help1.wav, Windows Media Player tries unsuccessfully to play the wav file. It err's saying ClassFactory cannot supply the requested class. But WMP has no problem at all playing c:\windows\system32\ ALSNDMGR.WAV. That goes...
3
8306
by: felecha | last post by:
I can get Windows Media Player to start, and play a wav file just fine using a command line "C:\Program Files\Windows Media Player\wmplayer.exe" c:\Temp\temp.wav But I want it to come up from a VB.Net application, so the user will select the recording he wants and click a button and code will call Shell("C:\Program Files\Windows Media Player\wmplayer.exe c:\Temp\temp.wav")
3
10642
by: Jared | last post by:
I'm using the first code sample below to play WAV files stored as embedded resources. For some reason I *occasionally* get scratching and crackling. I'm using a couple WAVs that ship with Windows, and they play fine outside of my app. This code works, but has the random "scratching" problem: private static void PlayResource(string audioRes) { // Get the resource into a stream
9
5614
by: Morris Neuman | last post by:
Im working with VS 2005 and trying to use a Hyperlink field in a datagrid to play a wave file that is not located in the website folders but is in a plain folder on the same machine, windows 2003 server, WMP 10.0 . If I type the full path in an IE address field it plays the file in WMP When I test my Web page ( running the debugger in VS.) The datagrid has a column called "MsgFile" with the full path to the wave file e.g....
2
1550
by: rodchar | last post by:
hey all, how do i play media files on my web page? thanks, rodchar
9
3601
by: ZikO | last post by:
Hi. I'm struggle with playing a wav in Visual Basic. First I wanted to use My.Computer.Audio.Play() method but I realized it's not working if I want to have music in background. I found in internet SoundPlayer Class but unfortunately I can't find it in my Visual Studio Application. Whenever I try to use it Dim Player New SoundPlayer ...
13
4902
by: anil.rita | last post by:
When the user chooses an AV file to play, based upon the type of file, I want to use the default installed media player to play it. I am wondering if this is a good way - any alternatives, suggestions or improvements? if( wmv file) document.write("<OBJECT id=Player classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height="354" width="479">
8
14952
by: raylopez99 | last post by:
I have the latest version of Visual Studio 2008 Professional, which allows you to create resource files (this is the .resx file, no?), unlike the Express version, which does not. I am trying to cut and paste code that MSDN recommends for playing a simple wav file from inside an embedded file, like presumeably the 'resources' file .resx is. I want to embed the .wav file in a 'resource file' since I don't want the user storing the file on...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.