In addition to supporting "standard" podcasting in FeedDemon, I'd also like to enable clicking an enclosure to add it to the current Windows Media Player playlist. In Explorer, you can do this by right-clicking an MP3 and choosing "Add to Now Playing List," but this feature is apparently buried inside wmpshell.dll and isn't exposed anywhere, nor can it be done using a command line parameter.
If you're a developer and you know how to do this programmatically, please let me know! I'd be happy to give you free copies of both TopStyle and FeedDemon in return.
You might want to look at IWMPPlaylist. appendItem looks a good candidate.
Note that I have never done this, just did a couple of quick searches and dug this up. HTH.
Posted by: John | Tuesday, November 09, 2004 at 07:49 PM
Nick,
Erwin over at www.dopplerradio.net incorporated this feature into his .Net based podcasting client. You might want to send him an inquiry.
Posted by: Randy | Tuesday, November 09, 2004 at 08:37 PM
In the same vein.
Posted by: Paul | Tuesday, November 09, 2004 at 08:43 PM
Sorry see URL http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/playlistobject.asp
Posted by: Paul | Tuesday, November 09, 2004 at 08:45 PM
Randy, Doppler adds the download to a playlist, but it doesn't add it to the "Now Playing" playlist, which is what I want to do. My goal is to enable building the current playlist by clicking a series of enclosures, and have them automatically play in sequence.
Posted by: Nick Bradbury | Tuesday, November 09, 2004 at 08:53 PM
Unfortunatly for you, I have to go to a birthing class (wife's due in dec/jan).
But here's how I would go about solving this issue.
We know from looking in the registry that "wmpshell.dll" acts as a context menu handler (look on codeproject.com/shell/shellextguide2.asp for more cool info)
[registry: HKEY_CLASSES_ROOT\CLSID\{F1B9284F-E9DC-4e68-9D7E-42362A59F0FD}]
[registry: HKEY_CLASSES_ROOT\mp3file\shellex\ContextMenuHandlers\WMPAddToPlaylist]
Using the OLEView tool (comes with DevStudio6), go to the View>View Typelib menu option.
Select wmpshell.dll.
Notice the
"[
uuid(F1B9284F-E9DC-4E68-9D7E-42362A59F0FD),
helpstring("WMPAddToPlaylistLauncher: Not Public. Internal object used by Windows Media Player.")
]
coclass WMPAddToPlaylistLauncher {
[default] interface IUnknown;
};"
It has the same CLSID!
What you need to do CoCreateInstance of WMPAddToPlaylistLauncher, and QueryInterface for IContextMenu (ot IContextMenu2 or 3) and call IContextMenu::InvokeCommand.
I would suggest reading the MSDN KB titled "Creating Shortcut Menu Handlers" as well as the excelent "The Complete Idiots Guide to writing shell extensions" on codeproject.com.
Later, I'm off to learn how to change a diaper.
Posted by: Jason | Tuesday, November 09, 2004 at 09:06 PM
I did a bit of digging around with media player to try and accomplish what you want and so far I've come kind of close. First WMP stores the now playing list (XP) in "C:\Documents and Settings\Administrator\Application Data\Microsoft\Media Player\1501563B.wpl" Obviously it would vary with the user account and the file name may be different as well.
I found that I could add to the XML in the file, however, it would not update automatically in WMP. Some further testing and I found I could load the now playing list by via the command line 'wmplayer.exe "C:\Documents and Settings\Administrator\Application Data\Microsoft\Media Player\1501563B.wpl"' However, that starts the playlist at the first item on the list. And it calls it 1501563B rather than now playing, so technically it's loading it as a seperate playlist.
If there is a way to 'refresh' the now playing list to sync it up with the xml file perhaps you could go that route.
Posted by: Chris | Tuesday, November 09, 2004 at 09:24 PM
What about Player.currentPlaylist? You can obtain current playlist and then just do .appendItem to it
More info here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/playercurrentplaylist.asp
Posted by: Oxygen | Tuesday, November 09, 2004 at 09:47 PM
Take a look at http://www.alexfeinman.com/download.asp?doc=AddToPlayList.zip
Posted by: Alex Feinman | Tuesday, November 09, 2004 at 10:01 PM
Clicked Post too quickly. Basically the code found at the url above will create an instance of context menu, interrogate it to find the Enqueue item by language-independent verb (WMPEnqueue) and invokes it. It is uses pieces of code provided by Raymond Chen in his blog (The Old New Thing)
Posted by: Alex Feinman | Tuesday, November 09, 2004 at 10:06 PM
Hi Nick,
The Windows Media Player SDK is the place to look...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/playlistobject.asp
Best regards
Steve
Posted by: Steve | Wednesday, November 10, 2004 at 08:25 AM
Sorry that URL should be:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/windowsmediaplayer10sdk.asp
Posted by: Steve | Wednesday, November 10, 2004 at 08:26 AM
Reading a little deeper:
Once you have verified that the user has Windows Media Player 9 Series or Windows Media Player 10 installed, you can use the Player.openPlayer method to open the content in the full-mode Player. The openPlayer method ensures that your content is initially displayed in the Now Playing feature of the full-mode Player, rather than in a skin, in mini Player mode, or in another player that has registered itself as the default program for files with an .asx file name extension, but doesn't support HTMLView.
You can then call player.currentPlaylist to get the current playlist
http://msdn.microsoft.com/library/en-us/wmplay10/mmp_sdk/playercurrentplaylist.asp?frame=true
You can then use player.currentPlaylist.appendItem(item)
http://msdn.microsoft.com/library/en-us/wmplay10/mmp_sdk/playlistappenditem.asp?frame=true
Best Regards
Steve
Posted by: Steve | Wednesday, November 10, 2004 at 08:45 AM
Wow - thanks for all the great suggestions! I'll be tackling this throughout the day, and I'll follow-up here if/when I get it working.
Jason, your approach is the one I had been working on, but I was concerned about relying on an unexposed feature in wmpshell.dll. MS could change the behavior down the road, which would mean this feature could stop working in FeedDemon.
Steve, I spent several hours with the WMP SDK yesterday, but somehow missed the fact that Player.openPlayer will open the file in the full player - everything else I tried opens an embedded WMP, so your approach may be the solution. Thanks!
Posted by: Nick Bradbury | Wednesday, November 10, 2004 at 11:03 AM
Slightly off topic but related to this....
It would be nice if you supported Winamp as well. Any plans to do this?
Thanks,
Kevin
Posted by: Kevin | Wednesday, November 10, 2004 at 01:25 PM
Unexposed, pfft! what isn't. ;-)
So much for the free reg, on the plus side I know know more than I ever wanted to know about lactation! (yay?)
Posted by: Jason | Wednesday, November 10, 2004 at 02:13 PM
Jason, Steve, Chris: even though I'm still struggling with the solution, you obviously spent some time doing detective work here, so I'd like to send you each a free copy of my software. Just send me an email (or use my contact form at http://www.bradsoft.com/contact/mailform.asp ) and I'll reply with the details. Thanks!
Posted by: Nick Bradbury | Wednesday, November 10, 2004 at 04:02 PM
Steve, turns out that player.currentPlaylist doesn't return the "Now Playing" playlist, so I'm afraid it's back to square one :)
Posted by: Nick Bradbury | Wednesday, November 10, 2004 at 04:03 PM
So perhaps you want to reconsider the Context menu approach. At the very least we know that the verb name has not changed between WMP 9 and 10 (and the feature did not exist prior to WMP 9), so one can expect that it will be there for a while.
Posted by: Alex Feinman | Wednesday, November 10, 2004 at 06:38 PM
Biggest problem with WindowsMediaPlayer.openPlayer is it overwrites the current "Now Playing" playlist (at least it does on my machine)
Posted by: Brian Swanson | Thursday, November 11, 2004 at 12:42 PM
Kevin, I just searched for information on scripting WinAMP, and came across the news that it's no longer being developed:
http://www.betanews.com/article/Death_Knell_Sounds_for_Nullsoft_Winamp/1100111204
Posted by: Nick Bradbury | Thursday, November 11, 2004 at 03:11 PM
Nick, I'm not sure if this is what you're after but... The following code will add the given song to the "Now Playing List". It's pretty simple but you'll need to translate to Pascal. :-)
SHELLEXECUTEINFO si;
::ZeroMemory(&si, sizeof(SHELLEXECUTEINFO));
si.cbSize = sizeof(SHELLEXECUTEINFO);
si.lpVerb = "open";
si.lpFile = "c:\\temp\\abc.wma";
ShellExecuteEx(&si);
Posted by: Rob Fahrni | Thursday, November 11, 2004 at 06:45 PM
Thanks for the tip, Rob. Unfortunately, this doesn't do what I'm looking for. It adds the file to the now playlist list - but it also removes everything else from the list and starts playing immediately. What I'm wanting to do is add the file to the current now playing list, so that you can simply click several enclosures in FeedDemon and listen to them all in a row.
Posted by: Nick Bradbury | Friday, November 12, 2004 at 12:40 PM
Nick,
That's kind of what I thought. The neat thing about using ShellExecuteEx is it will instantiate IContextMenu and call IContextMenu::InvokeCommand for you with the given verb.
I think it's the correct way to go IF you can figure out what verb to use because you only have to make a single call to invoke it.
Now if you could get someone to tell you the verb for add something to get "Now Playing List" you'd be skating.
Heck, you may want to try 'add' as the name of the verb and see what happens?
Posted by: Rob Fahrni | Friday, November 12, 2004 at 01:10 PM
Rob, are verbs even used for context menu extensions? I thought extensions were handled differently.
Posted by: Nick Bradbury | Friday, November 12, 2004 at 01:34 PM
Nick,
A quick search of IContextMenu::InvokeCommand is what lead me to post the ShellExecuteEx sample. URL below...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/icontextmenu/invokecommand.asp
The docs for IContextMenu::InvokeCommand say you can "...invoke this method indirectly by calling ShellExecute or ShellExecuteEx and specifying a verb..."
I won't claim to be an expert on the IContextMenu interface or the ShellExecuteEx API, so maybe I was too hasty and didn't read far enough to find caveats?
Posted by: Rob Fahrni | Friday, November 12, 2004 at 01:51 PM
Kevin, I just searched for information on scripting WinAMP, and came across the news that it's no longer being developed
Until just recently neither was MSIE. What's your point?
;)
Btw, how did you like Brand New?
Posted by: Rev. Bob | Saturday, November 13, 2004 at 05:58 PM
From what I know of Windows Media Player, the playlist functionality is defined in the following interfaces that are implemented in the 'wmp.dll' interface:
IWMPPlaylist
IWMPPlaylistArray
IWMPPlaylistCollection
IWMPPlaylistCtrl
IWMPPlaylistCtrlColumn
Descriptions of each of these interfaces and implementations can be obtained from the Microsoft Windows Media Player SDK which is freely available from Microsoft.
Cheers,
Darryl Staflund
Posted by: Darryl A. J. Staflund | Sunday, November 14, 2004 at 07:17 PM
Err, "...'wmp.dll' interface..." should read "...'wmp.dll' component...".
Cheers,
Darryl Staflund
Posted by: Darryl A. J. Staflund | Sunday, November 14, 2004 at 07:18 PM
I came across this site http://www.wmplugins.com/default.aspx that looks like it may be helpful to you.
Specifically I found this plug in "Player Pal" http://www.playerpal.com/ that seems to offer the specific functionality you are looking for (adding to an existing playlist).
Posted by: Peter | Tuesday, November 16, 2004 at 06:42 PM
I have upload a little Demo written in Delphi that add MediaFiles to a selected WMP Playlist.
I don't know if it is exactly what you are looking for.
http://atl.chris-online.info/wmpdemo.zip
P.S: You need to import the wmp.dll into Delphi (Components->ActiveX).
Posted by: Marco | Wednesday, November 17, 2004 at 03:13 AM
Marco, thanks for the example code - but unfortunately, it doesn't do what I'm looking for. What I need to do is add a file to the "Now Playing" playlist, so that it's added to the queue. In other words, I want to enable FeedDemon customers to click a series of audio enclosures and have them automatically play in order.
Posted by: Nick Bradbury | Wednesday, November 17, 2004 at 09:27 AM
On Winamp no longer being developed... Have you looked at Winamp? What needs to be done on it? ;-)
It is pretty much a complete product as it is. I can't think of anything I'd want added to it. Although.... I would like it to default to using Firefox rather than IE. But that's the only thing and I can live with that. After all, FeedDemon's already counting me as a IE user on evey site I visit with it- when in reality I'm an exclusive Firefox user!! That's why I don't believe browser statistics at all. Everyone I know is using Firefox: friends, family and now our whole company uses it (not a big company though: 9 people). Even the "building maintenance" guy mentioned Firefox the other day!!
Anyway, the news of Winamp no longer being developed is not official. Only the "original developers" have left the project. While that sounds like a death-knell it may not be. Think about Delphi... how many of the original developers are working on it now? Many have left and the product is incredibly strong still.
Until there's some proof that the product is really no longer being developed I will keep on using it.
Besides... Winamp is so _EXTENSIBLE_ that the community will continue extending it ad infinitum.
Cheers,
Kevin.
Posted by: Kevin | Wednesday, November 17, 2004 at 10:50 AM
here's a working code in python. it shouldn't be so different from c++.
(tested with activestate python)
from win32com.client import Dispatch
# get Media Player COM object
wmp = Dispatch("WMPlayer.OCX")
# play a file !
wmp.openPlayer("C:/a.mp3")
# new file
newItem = wmp.newMedia("c:/b.mp3")
# append new file to playlist
wmp.currentPlaylist.appendItem(newItem)
# print current media name
print wmp.currentMedia.name
# play next in playlist
wmp.next()
# print current media name
print wmp.currentMedia.name
Posted by: Edward Park | Wednesday, November 17, 2004 at 12:07 PM
Thanks, Edward, but this still doesn't add to the "Now Playing" list. I need to add a file to WMP's "Now Playing" list so that it's automatically played in the order that's it added.
Posted by: Nick Bradbury | Wednesday, November 17, 2004 at 12:21 PM
had an error in the python code:
# play next in playing
wmp.controls.next()
and it's not really working as expected... the control commands are not passed to the Media Player with the UI. It feels like there is an invisible player apart from the UI. if controls.play() is used instead of openPlayer() it works well (but without the UI).
Posted by: Edward Park | Wednesday, November 17, 2004 at 12:34 PM
More on the Winamp thing...
This is from the "llama's mouth" so-to-speak... Winamp is not dead.
http://www.winamp.com/about/article.php?aid=10627
Posted by: Kevin | Thursday, November 18, 2004 at 10:55 AM
Thanks for the update, Kevin - looks like I should've checked my sources before believing that WinAmp was deceased.
Posted by: Nick Bradbury | Thursday, November 18, 2004 at 12:19 PM
I want to use WMP 9 or WMP 10 to stream encoded video to wireless PDAs with PPC. I want to use my own decoder plug-in. I was told it is not possible to use a plug-in for PPC with the SDK for WMP9 available. Any response?
Posted by: Jay Ramasastry | Friday, November 19, 2004 at 02:22 AM