INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Having issues implementing the COM automation interface. (Need some pointers)  (Read 4527 times)

bdhall

  • Member
  • *
  • Posts: 4

I have used some of the Media Center Command Line Parameters and Media Center Core Commands for a while, but I have been recently attempting to implement the Com automation interface using VB.net (2005).

Can you access the Media Center Command Line Parameters and Media Center Core Commands from the Com Automation interface?

I have been able to get some basic commands to work  such as play, stop, setting the active zone, etc.

I would like to be able to provide a playlist by name and play it's contents.

I would also like to be able to provide a specific file name and play it.

Is there a straight forward way to do this using the Com automation interface?


Below are some things I seem to be able to do from the Com automation interface:
mcAutomation.GetPlayback.Play()
mcAutomation.GetPlayback.Stop()
mcAutomation.GetZones.SetActiveZone(2)


mcAutomation.GetCurPlaylist.RemoveAllFiles() ----- (I can see the files removed from the list in Media Center)
mcAutomation.GetCurPlaylist.AddFile("C:\Wave\comm01.wav", 0) -----(I can see my file added in  Media Center in the same location that the files were removed in the previous step. But if I do the play command from the Com automation interface a message pops up in Media Center saying that there is nothing to play. Repeating the command gives the same result. However, if I click on the play button in Media Center the file I added will play. From that point I can control basic functions play, stop, etc. using the Com automation interface. But if I do the RemoveAllFiles and AddFile commands I get the same thing again if I try to send a play command.)

If anyone could enlighten me as to the proper steps to accomplish what I am describing, it would be a big help.


Also I was curious as to if I should be trying to use the following - shows up in the Object browser in Visual Studio .net:

If this is the desired approach, what do you have to do to access it?

Automation Objects
MJAutomation - core object... provides access to all other objects
MJPlaybackAutomation - controls playback and provides information about the currently playing track
MJFilesAutomation - represents a collection of files
MJFileAutomation - object for dealing with a single file
MJCurPlaylistAutomation - interface for working with "Playing Now" (the current playlist)
MJMixerAutomation - provides volume, balance, and mute control
MJPlaylistsAutomation - represents a collection of playlists
MJPlaylistAutomation - interface for working with a single playlist
MJSchemeAutomation - interface for working with Media Library View Schemes
MJVersionAutomation - interface for getting Media Center version information
MJInternetAutomation - interface for helping in downloading files from internet
MJViewItemAutomation - interface for creating / walking the Media Center tree structure
MJFieldsAutomation - interface for working with database fields
MJFieldAutomation - interface for working with an individual database field
MJZonesAutomation - interface for working with multi-zone playback system
MJZoneAutomation - interface for working with a single playback zone (requires MC 11.0.20 or later)
MJTaskAutomation - Interface for working with a task
MJServicesAutomation - interface for working with services
MJServiceAutomation - interface for working with a single service
MJCDDVDAutomation - interface for working with CD/DVDs


Sorry for the lengthy post and I hope it makes at least a little sense.

Thanks in advance for any ideas any of you may have.

Brian
Logged

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D

I have used some of the Media Center Command Line Parameters and Media Center Core Commands for a while, but I have been recently attempting to implement the Com automation interface using VB.net (2005).

Can you access the Media Center Command Line Parameters and Media Center Core Commands from the Com Automation interface?

I have been able to get some basic commands to work  such as play, stop, setting the active zone, etc.

I would like to be able to provide a playlist by name and play it's contents.

I've not got any direct answers for you at the moment, (It's late here and i'm heading to bed!)
but there's a lot of sample code here, all of which is either VB.NET or C# (different syntax but otherwise the same)
http://yabb.jriver.com/interact/index.php?topic=33020.0

The very last sample script by Eba uses an interesting technique of specifying a search criteria
to get files, and searches for a specific playlist.

This might be of interest to you.

The code examples were generated for the .NET Script plugin written by myself,
more information can be found through links in my signature.

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?

Thanks, ChriZ.
Logged

Messiahs

  • Galactic Citizen
  • ****
  • Posts: 432

i think you have to set the postion before playing:

Code: [Select]
MCCurPlaylist.Position = x
Dim aPlayback As MediaCenter.IMJPlaybackAutomation
aPlayback = mediaCenterRef.GetPlayback

aPlayback.Play()

morgan

  • Guest

Quote
I can see my file added in  Media Center in the same location that the files were removed in the previous step. But if I do the play command from the Com automation interface a message pops up in Media Center saying that there is nothing to play. Repeating the command gives the same result. However, if I click on the play button in Media Center the file I added will play.

I'm not using COM specifically, but I've noticed that I get the "Warning: There is nothing to Play" message if the active view is not something with a playlist in it.  i.e. The play command is sensitive to the active view.

For example, if you select a view and make it show the "UPnP Server", or "Library Server" from the service sidebar, and then press play, you'll get the "There is nothing to play" message, (even if a playlist is visible on the screen somewhere.)  Making the playlist view active will make the play button respond "properly".

I've no idea how you would get around this from COM automation...

Logged
Pages: [1]   Go Up