INTERACT FORUM

Windows => Plug-in Development => Topic started by: PaulSinnema on April 25, 2007, 01:13:22 pm

Title: Can't play a file using the IMJPlayBackAutomation object
Post 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:

Code: [Select]
        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.
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: PaulSinnema on April 25, 2007, 02:07:22 pm
I think I need to make a general observation as well. When I do the following:


No Problem here:

If however I do the following:


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.
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: PaulSinnema on May 01, 2007, 02:40:10 am
Bump
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: PaulSinnema on May 14, 2007, 11:04:57 am
Hate to do this but would like an answer (if possible). Bump
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: John Gateley on May 14, 2007, 12:39:07 pm
I'll take a look when I get a chance...

j
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: PaulSinnema on July 13, 2007, 02:28:30 pm
What about this one John?
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: Messiahs on August 05, 2007, 01:37:51 pm
try setTrack(0) or playfile(0)
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: Matt on September 03, 2007, 12:34:15 am
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.
Title: Re: Can't play a file using the IMJPlayBackAutomation object
Post by: PaulSinnema on September 03, 2007, 07:22:09 am
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.