How to load a file in IWMPPlayer without playing it? - windows

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.

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.

Related

WP7: Is it possible to intercept the backstack before the journal thumbnail is created/stored

You all know the Windows Phone backstack right. If you go through some apps, tap the Home key after starting each app. Now tap and hold the Backkey to see the Backstack. You can now see some small images of your apps, and can pick which one to go to right.
Question:
Is it possible to intercept before the backstack image is created? I have tried to blur my page in various events (include OnNavigatingFrom) to no avail.
My guess is some other event (probably something we don't have access to) is triggered and a bitmap is created, because when you use the Backstack to navigate you can just see a slight transition from the saved image to a real page IMO.
Does anyone know if its possible to intercept or manipulate these images on the backstack?
Example screenshot from WP emulator of the Backstack thumbnails
Following my comment, I've just tried this:
Set a breakpoint anywhere in the code
Start the app with the debugger attached, then let it reach the breakpoint
While the execution is stopped by the debugger, long press on the back button
The task switching UI is displayed even though the managed code execution is stopped
From there, I think we can safely conclude that the task switching and the thumbnail are handled entirely by native code. Therefore, there's nothing you can do.
I recently wrote a blogpost in which I discuss the ways I tried to hide data from the application snapshot. (You can read it here: http://corstianboerman.com/trying-to-hide-crucial-data-from-an-application-snapshot/)
The outcome: You just can't hide it.

How to identify a window playing a video in a browser

I wish to understand how one can programmatically identify if a window is playing video content?
I used spy++ to identify particular attributes for windows playing video but I did not find any particular attributes associated with window playing video.
I have handles to all windows on screen and want to find which ones are playing video ? Could you please throw some light on how can one do this and are there any special properties associated with a window playing video?
I found similar article :
can we get window handle of the window which is playing video?
But I don't want to minimize application , I know user is using browser(ie,firefix,chrome) to watch video (from youtube,hulu)and window is visible on screen.
You can if you have execution privileges over the environment the Flash Player is executed in. You can listen for the playing event thrown by the Flash Player.
Listen for my Flash event in Javascript

How can I stop background audio played by other apps?

I have an app for WP7, using BackgroundAudioPlayer as we need to play in the background. The problem is, when there's already an app playing audio in the background, I can't get my AudioPlaybackAgent work, the previous music just keep playing.
The document introduced this way,
BackgroundAudioPlayer.Instance.Close();
by which I can only close the audio that is played by myself or Zune, but it doesn't work when the audio is played by other apps.
So is there a way to close all the playing audio?
OK I fixed it.
What I did to get it play is like this, first I set a track to the player:
BackgroundAudioPlayer.Instance.Track = ...;
Then an OnPlayStateChanged event will fire in the background agent, where I call the BackgroundAudioPlayer.Instance.Play() method. This seems to work great.
But if the background player is already being used by another app, the PlayState won't change to TrackReady when I set the track, and consequently the event won't fire.
To fix this, I simply call the .Play() method in the main UI thread, right after setting the track. And it works.

JW Player - How can I add an event listener for fullscreen toggling?

I'm using JW Player 4.5 on my site and I need to add an event listener for when fullscreen is toggled.
The reason for this is to switch between a low-def version and high-def version. The default video will be the low-def version and when they switch to a fullscreen display, it will change to the high-def version.
According to http://developer.longtailvideo.com/trac/wiki/Player5Events, the ViewEvent.JWPLAYER_VIEW_FULLSCREEN1 event can only be called from Actionscript. I need it to be from Javascript...
Is there any way to achieve this? Can you recommend a better solution?
If I understand you correctly, what you're trying to do is switch from a low-def file to high-def file when the user moves into full screen. For this, you'll want to detect the fullscreen event (rather than send it). For this, you'll want to add a listener for ControllerEvent.RESIZE and look at the fullscreen property. Check out the player events page (http://developer.longtailvideo.com/trac/wiki/Player4Events) for more info.
In terms of doing the actual switch, you'll want to do a load (ViewEvent.LOAD) with the path as the argument. This can be done regardless of the fullscreen state.
Additionally, you'll probably want to seek (ViewEvent.SEEK) with the current position as the argument. I should note that this is only possible using some sort of streaming server (http or RTMP), as there's no way to seek ahead in progressively downloaded files.
However, rather than implement all of this, you could just use our built in bitrate switching (http://www.longtailvideo.com/support/jw-player/jw-flv-player-v4/27/bitrate-switching) (which performs automatic bandwidth detection) or modify the source (http://developer.longtailvideo.com/trac/browser/plugins/hd) of our HD plugin (http://www.longtailvideo.com/addons/plugins/65/HD).
Best,
Zach
Developer, LongTail Video

How to capture actions taken on Windows Media Player

I want to programmtically detect the state of movie currently being played in Windows Media Player. i..e if the movie is maximized I need to find that it is maximized and put the word "MAXIMIZED" in text file, if the movie is paused I need to capture PAUSED in text file, if movie is stopped I need to capture STOPPED in text file.
The capturing needs to happen in the background i.e. totally transparent to end user as the user takes action while watching the movie on Windows Media player
I am planning to achieve this using Visual Basic 6.0
Kindly provide me inputs / pointers on how to go about this.
Thanks
I think only way how to do this, is using Windows Media Player SDK.
Windows Media Developer Center
You have to create a Media Player plugin and access the state using the Media Player API.
Theoretically you could also do some external analysis of the Media Player, for example by enumerating its windows and handles and reading window texts, but that would be very "hacky" and most fragile.
Although creating a plugin sounds like a lot of work, it'll be the better solution in the long run.

Resources