• How to Create Media Player by C# ?

    ashish Member

    I’m new to this world, I made some small programs by C#, and now planning to make my own media player there is no tutorial for this one in C#

  • Ganesh Member

    If you are new to C# I wouldn’t recommend create your own.Why don’t you add the Windows Media Player control? It’s built in. See link below.

    http://msdn.microsoft.com/en-us/library/windows/desktop/dd564585(v=vs.85).aspx

    Do you want to be able to select files to play? You can always add a menu to your app 'File>Open'

    Follow the link above and then add the MediaPlayer, a MenuStrip with a File>Open menu to your form.

    Then add the following code to the form matching the control names you have added (they should be the same if you kept the default). Obviously, you need to add error checking and logic for the user interface.

    public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
    
            }
    
            private void openToolStripMenuItem_Click(object sender, EventArgs e)
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "Video Files(*.WMV;*.AVI;*.MP4)|*.WMV;*.AVI;*.MP4";
                ofd.ShowDialog();
                axWindowsMediaPlayer1.URL = ofd.FileName;
            }
        }
    

    Link to the Windows Media Player SDK which gives way more control of the player.

    http://msdn.microsoft.com/en-us/library/windows/desktop/dd758070(v=vs.85).aspx

  • Amit Member

    thank you for your respond

    Why don’t you add the Windows Media Player control?

    This is the problem, i don’t know how to add add the Windows Media Player control to my project ? tell me please how to do this.

  • Adan Member

    Ok, follow these steps.

    • In the Form Design right-click on any item in the Toolbox and click Choose Items
    • Select the COM Components Tab
    • Scroll down and check Windows Media Player and click Ok (If Windows Media Player does not appear in the list, click Browse, and then open Wmp.dll, which should be in the Windows\System32 folder)
    • You should now see the Windows Media Player Control in the Toolbox
    • Drag the control to your form or add it dynamically
  • Amit Member

    BASS is an audio library for use in software on several platforms. Its purpose is to provide developers with powerful and efficient sample, stream (MP3, MP2, MP1, OGG, WAV, AIFF, custom generated, and more via OS codecs and add-ons), MOD music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), and recording functions. All in a compact DLL that won’t bloat your distribution.

    
        Samples
        Support for WAV/AIFF/MP3/MP2/MP1/OGG and custom generated samples
    
        Sample streams
        Stream any sample data in 8/16/32 bit, with both "push" and "pull" systems
    
        File streams
        MP3/MP2/MP1/OGG/WAV/AIFF file streaming
    
        Internet file streaming
        Stream data from HTTP and FTP servers (inc. Shoutcast, Icecast & Icecast2), with IDN and proxy server support and adjustable buffering
    
        Custom file streaming
        Stream data from anywhere using any delivery method, with both "push" and "pull" systems
    
        OS codecs
        ACM, Media Foundation and CoreAudio codec support for additional audio formats
    
        Multi-channel streaming
        Support for more than plain stereo, including multi-channel OGG/WAV/AIFF files
    
        MOD music
        Uses the same engine as XMPlay (very accurate, efficient, high quality reproduction), with full support for all effects, filters, stereo samples, DMO effects, etc.
    
        MO3 music
        MOD music with MP3 or OGG compressed samples (vastly reduced file size with virtually identical sound quality), MO3s are created using the MO3 encoder
    
        Multiple outputs
        Simultaneously use multiple soundcards, and move channels between them
    
        Recording
        Flexible recording system, with multiple device support and input selection, (WMA encoding & broadcasting via the add-on, and other formats via BASSenc)
    
        Decode without playback
        Streams and MOD musics can be outputted in any way you want: encoded, written to disk, streamed across a network, etc.
    
        Speaker assignment
        Assign streams and MOD musics to specific speakers to take advantage of hardware capable of more than plain stereo (up to 4 separate stereo outputs with a 7.1 soundcard)
    
        High precision synchronization
        Synchronize events in your software to the streams and MOD musics, synchronize playback of multiple channels together
    
        Effects
        Chorus / compressor / distortion / echo / flanger / gargle / parametric eq / reverb
    
        Custom DSP
        Apply any effects that you want, in any order you want
    
        32 bit floating-point decoding and processing
        Floating-point decoding/rendering, DSP/FX, and recording
    
        3D sound
        Play samples/streams/musics in any 3D position
    
        Flexible
        Small buffers for realtime performance, large buffers for stability, automatic and manual buffer updating, configurable threading, configurable SRC quality
    
        Expandable
        Add-on system for additional format support and effects (C/C++ API available on request), dynamic plugin loading system
    
        64-bit support
        Both 32-bit and 64-bit architectures are supported 
    

    Bass.Net 2.4.10.4
    .Net API for BASS and all of the add-ons.
    Can be used with both C# and VB

Viewing 4 reply threads
  • You must be logged in to reply to this topic.
en_USEnglish