INTERACT FORUM

Please login or register.

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

Author Topic: Can't play a file using the IMJPlayBackAutomation object  (Read 3591 times)

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Can't play a file using the IMJPlayBackAutomation object
« 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.
Logged

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #1 on: April 25, 2007, 02:07:22 pm »

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.
Logged

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #2 on: May 01, 2007, 02:40:10 am »

Bump
Logged

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #3 on: May 14, 2007, 11:04:57 am »

Hate to do this but would like an answer (if possible). Bump
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #4 on: May 14, 2007, 12:39:07 pm »

I'll take a look when I get a chance...

j

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #5 on: July 13, 2007, 02:28:30 pm »

What about this one John?
Logged

Messiahs

  • Galactic Citizen
  • ****
  • Posts: 432
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #6 on: August 05, 2007, 01:37:51 pm »

try setTrack(0) or playfile(0)

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41941
  • Shoes gone again!
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #7 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.
Logged
Matt Ashland, JRiver Media Center

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: Can't play a file using the IMJPlayBackAutomation object
« Reply #8 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.
Logged
Pages: [1]   Go Up