0

I've got a project that uses IWMPPlayer4, the ActiveX interface to Windows Media Player. Downloading and playing a video from the Internet is easy: just call put_URL, and it connects to the video and begins to play it.

But what if I want to tell it to load up a video from a certain URL but not begin to play it yet? It's not clear from the documentation I've seen how I would do that, but I figure there has to be a way to accomplish it. Does anyone know how?

I tried calling get_controls and then either the Pause or Stop methods on the resulting IWMPControls interface immediately after calling put_URL, but both caused the same problem: no media actually loaded, and clicking the Play button on-screen plays nothing.

Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477

1 Answers1

0

It's been a long time since I've worked with WMP API's, but I think you want this:

IWMPSettings::put_autoStart

From the MSDN link above:

You should set put_autoStart to FALSE immediately before you set IWMPCore::put_URL, IWMPCore::put_currentPlaylist, or IWMPCore::put_currentMedia in skins and remoted Player controls if you wish to ensure that the media item does not start playing immediately. Also, unless you set put_autostart to TRUE immediately before specifying a media item, you should not rely on this setting as a substitute for using the IWMPControls::play method.

selbie
  • 100,020
  • 15
  • 103
  • 173
  • This seems to have the same basic problem: I say `put_autoStart(false)`, and then when I hit the Play button in the UI, nothing plays. Strangely, this only seems to happen the first time; after loading other media, it works. Is there some sort of initialization I'd need to run or something? – Mason Wheeler Feb 15 '14 at 01:16
  • @MasonWheeler - I suspect that you need to keep your play button disabled until the content (specified by the URL) is ready to be played. That is IWMPCore::get_status() will return "ready" (I forget the actual state string). You can use IWMPEvents::StatusChange notification to find out when the status has changed so you know when to refresh the UI and enable the button. – selbie Feb 15 '14 at 01:54