INTERACT FORUM
Windows => Plug-in Development => Topic started by: PaulSinnema on April 25, 2007, 01:13:22 pm
-
Hi,
I keep running into problems. I've added a 'Play' button to the Plugin and would like to be able to play it using the IMJPlaybackAutomation object. Clearing the current playlist goes OK. Adding my file also succeeds. Playing doesn't start however.
Here's the code I've added for playing:
private void buttonPlay_Click ( object sender, EventArgs e )
{
DataGridViewSelectedRowCollection rows;
IMJPlaybackAutomation playback;
IMJCurPlaylistAutomation playlist;
IMJFilesAutomation files;
rows = gridSongs.SelectedRows;
playback = mcRef.GetPlayback ();
playlist = mcRef.GetCurPlaylist ();
if ( rows.Count > 0 )
{
// Clear the current playlist
playlist.RemoveAllFiles ();
// Add my selected file. Unique hold the Unique number of the File
playlist.AddFileByKey ( (int)rows[0].Cells["Unique"].Value, 0 );
// Set the position to my file in the Current Playlist
playlist.Position = 0;
if (playlist.GetCanPlayNext ())
{
// Play it
playback.Play ();
}
else
{
addUserInfoText ( "Can't play next" );
}
}
}
}
Am I doing something wrong. If you would like to have all of my plugin code just give me call and I publish it somewhere.
Paul.
-
I think I need to make a general observation as well. When I do the following:
- Start MC
- I Click play in MC.
- A song starts playing
- I Click Pause in MC
- Song pauses
No Problem here:
If however I do the following:
- Start MC
- I open my plugin
- I Click Play of MC
- MC tells me 'There is nothing to play'
It seems as if MC changes it state when the Services & Plug-ins menu is opened and my plugin is selected.
Hope this helps.
Paul.
-
Bump
-
Hate to do this but would like an answer (if possible). Bump
-
I'll take a look when I get a chance...
j
-
What about this one John?
-
try setTrack(0) or playfile(0)
-
The best way to play files is to build a files collection (IMJFilesAutomationPtr) and issue a play command by calling IMJFilesAutomation->Play()
The older method of building Playing Now in code yourself is not recommended.
-
Hi Matt,
Thanks for the reply. had almost given up on this one! Ok, that probably will work for my playing button but the I still have an issue with this. I use a Remote Control and I've found out that when my plugin is active and has focus the 'Play next' button on my remote causes MC to say that there's nothing to play also. There defenitely is something the matter with MC in combination with Plugins here!
Paul.