1

Does anybody know or have any idea for how to play a video from the applications resources into an axWindowsMediaPlayer component?

I mean something like:

axWindowsMediaPlayer1.TheProperty = Resources.MyVideoResource;

Would be very nice, but I don't think such property exists..

Andres A.
  • 1,329
  • 2
  • 21
  • 37
  • Sure, WMP is a media player. Designed to deal with media coming from somewhere else. You'll have to step lower to stream from a resource. Like the DirectShow api, put .net behind it to find C# code. – Hans Passant May 25 '12 at 21:17
  • To help you, you can visit this : http://stackoverflow.com/questions/32094176/c-sharp-load-video-from-resources-folder-not-playing/36673786#36673786 – Pierre-Olivier Pignon Apr 19 '16 at 06:56

1 Answers1

3

Add Interop.axWMPLib and / or Interop.WMPLib references to your project

(if i don't remember wrong axWmpLib works with windows mp and if no wmp found on the pc then wmplib connects with any installed -or default- media player automatically which supports wmplib -i.e. winamp or splayer- .. i only worked once with this last year -2011 august- to surprise to my g.f. for her b-day.. so its worked as well before with a media list contains 2 mp3s and i give these codes directly except paths)

        private void axWindowsMediaPlayer1_ClickEvent(object sender, AxWMPLib._WMPOCXEvents_ClickEvent e)
        {
            axWindowsMediaPlayer1.URL = fullPathOfYourFirstMedia;
            axWindowsMediaPlayer1.Ctlcontrols.play(); // activates the play button
            axWindowsMediaPlayer1.Ctlcontrols.next(); // activates the next button
            WMPLib.IWMPMedia media = axWindowsMediaPlayer1.newMedia(fullPathOfYourSecondMedia);
            axWindowsMediaPlayer1.currentPlaylist.appendItem(media);
        }

if you take the medias from the resources then simply add your medias to your project's recources and give the full path strings' start as "Application.Startup"

sihirbazzz
  • 708
  • 4
  • 20