I'm using this solution to try to play an mp3 file in C# which I have inside a class library using this code: http://www.geekpedia.com/code111_Play-MP3-Files-Using-Csharp.html
I'm creating an instance, and calling the play method after opening a file and it doesn't play the mp3 file. Is this method deprecated nowadays as it dates back to 2008 or should this be working still?
Also worth pointing out, this is for a console application on Windows.
The code that is linked to in the question has to be run from an STA thread, otherwise it will not work.
Related
Is there a way to edit videos using c# without using a media library eg. Microsoft Expression Encoder etc.
Just need to be able to cut out unwanted parts or insert other videos into a specified time of the original video.
Can I edit the raw video file by perhaps converting it into a binary file and then cutting/pasting the code?
Most video formats have a container and a codec--that might be a good place to start
http://www.pitivi.org/manual/codecscontainers.html
If one were interested in implementing a program modifying video sans libraries a good place to start might be looking at the existing open source video libraries(eg FFMPEG https://www.ffmpeg.org/download.html ) as a reference
No there is no way to edit a video without using anything that would be considered a "library". You either must write your "library" or use a existing 3rd party one.
The only thing that could possibly not be thought of as a "library" is a full external tool that does what you want and your code would just be a front end GUI for it. For example writing a GUI front end for FFmpeg.
I have a video file at my Server and the path to which resembles like "10.151.98.82/Medias/New/Videos/001.dat".
(Actually a video file but the extension is in .dat)
I have already built a WPF application which allows my users to enter the above Server URL and then let them to download it and then play it.
But my guess is that they need not wait till the entire file gets downloaded; just watch the files on the fly.
I have googled on video streaming but could not get a solid material to proceed on with.
[Sorry, if the question is naive or needs modification, i will be happy to do that or move to a relevant forum.]
Any pointers on how to do this is much appreciated.
Edit: This question talks about WCF service and WPF application. But, I dont' use a WCF Service. The video file has to be streamed from the server.
First try to play your file using VLC Player. it also have many advance streaming and Trans-coding Options. you can play, save and trans code simultaneously. Once you are able to Play your file in VLC Player than i would recommend to use VlcDotNet for wpf application. Tutorial for hosting VlcDotNet is available in downloads
My requirements are:
- play a mp3 file on button click
- provide a option to seek to a particular time
Almost all of the tutorials/resources that I came through, used ".wav" files to play the sound. But I need to play a ".mp3" file within the application, preferably without using any 3rd party library(NAudio, BASS, etc). I expect, it can be done using the available classes of the System.Media namespace.
What is the difference between a .wav file and .mp3 file? Are they encoded in different manner, and need different media plugins to be played?
So any help regarding mp3 files would be appreciated. Thanks.
I don't believe System.Media supports MP3 files. Assuming you are using Windows, a possible approach could be to use the Windows Media Player API by adding a COM reference to "Windows Media Player" in the Add Reference dialog. Then add a using directive:
using MP = MediaPlayer;
and then instantiate the class:
MP.MediaPlayer mediaPlayer = new MP.MediaPlayer();
You can then play music files by calling:
mediaPlayer.Open("filename.mp3");
This open method seems to automatically play the media file once it is opened, however there are explicit Play() and Stop() etc methods you can use to customise this behaviour to your liking.
The XNA framework also has ability to play music files using isn't allowed to contain spaces for some annoying reason so I recommend you use the Windows Media Player API if this is intended to be used on a PC.
I hope this has put you in the right direction!
I have a question regarding with audio files.My question is:How can I play any audio file(e.g. mp3,wav) in C#? So if I press a button,I want to play to an audio file.
How can I do that? Can you tell me how it is done with a sample code?Lastly,I have used .Net Framework 4.0.
for that first you need to load wmp.dll from your system32 folder
Then you need to add COM component
Now you can do other things(creating player)
I have a tiny project (cutted NAudio version, only playback is left and only MP3 and WAV is supported) to play MP3 and WAV files. Do you still need it? I can upload it if you need to.
A full code example on how to play waves in c# forms apps can be found here
http://msdn.microsoft.com/en-us/library/ms173187%28v=VS.100%29.aspx
You can also play wave files using C# and the XNA Framework. But that may not serve your purpose, since that is primarily for games development.
I'm building a video system, and have came across a problem of accessing a video held in a remote location. Now predicament is that I don't want to mess around with the zip file by extracting the data, this would take too long from a user perspective and would rather be able to open video file directly from within side the zip. My question is, is this possible? The ability to open a file is not something I've found within the DotNetZip library.
The only solution I've found is pointing VideoLAN at the zip file and playing it from there. However, doing this programmatically is something I'm massively struggling with, through the VideoLan DotNet for WinForm & WPF C# plugin and it's lack of examples. Just wondering is there any alternative means?
Why dont you use the VLC ActiveX Directly ,just import the AxVlc.dll to you're project ,than you can select the VLC Plugin from Toolbox in VS (VLC Plugin v2 prefered).
Than you can do something vlc.playlist.add("FileName",Null,""); than use vlc.playlist.play(); version's under 0.9.9 works with Loop ,new version's you should build the Loop Function by you're self.
What's the reason of compressing video files? They are already compressed, and far better than zip can do.