Skip to content
This repository has been archived by the owner on Aug 7, 2018. It is now read-only.

when paused itunes starts upon locking #34

Open
GoogleCodeExporter opened this issue Mar 13, 2015 · 9 comments
Open

when paused itunes starts upon locking #34

GoogleCodeExporter opened this issue Mar 13, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. itunes is paused
2. lock windows (win+L)
3. itunes starts playing!

What is the expected output? What do you see instead?
That itunes remains paused!

What version of the product are you using? On what operating system?
1.0.1b
windows 7 
itunes 10

Please provide any additional information below.
<3

Original issue reported on code.google.com by rowan.l....@gmail.com on 22 Sep 2010 at 1:43

@GoogleCodeExporter
Copy link
Author

I've tested the same with Windows 7 Home premium/ itunes 10 64bit and its 
working fine. Could you please remove the existing monitores.exe file and try 
with the new one ?

Original comment by cumakt on 22 Sep 2010 at 5:03

@GoogleCodeExporter
Copy link
Author

I have carried out the following steps:
* Deleted old MonitorES.exe + MuteVista.dll
* Insured that it is no longer running
* Downloaded the new one from 
http://monitores.googlecode.com/files/MonitorES_1.0.1b_Installer.exe
* started monitor es
* unset all settings
* started itunes (without music playing)
* locked computer (itunes does not start playing)
* set to auto pause media and to use pause button, saved
* locked computer, itunes starts playing

Incidentally when I go to about it says that it is version 1.0b

Original comment by rowan.l....@gmail.com on 23 Sep 2010 at 10:06

@GoogleCodeExporter
Copy link
Author

Wow, Thanks for the detailed steps. Let me verify on other boxes(I followed 
your steps and it worked fine).

Original comment by cumakt on 23 Sep 2010 at 4:10

@GoogleCodeExporter
Copy link
Author

I can confirm, I have the same issue.  I leave itunes open on my computer all 
the time for home sharing, but if I attempt to use the auto pause option iTunes 
begins playing as soon as I lock the screen.  Sort of defeats the point.

Original comment by wisdomw...@gmail.com on 10 Apr 2011 at 8:25

@GoogleCodeExporter
Copy link
Author

The same happens in Spotify.  monitores seems to unconditionally toggle pause 
upon lock and unlock in Spotify and apparently iTunes (I don't use it so I'll 
have to take the other users' word for it).

Winamp is unaffected and behaves as expected.  If I pause or stop playback 
prior to locking the PC, Winamp remains paused or stopped upon lock and unlock.

Original comment by stars...@gmail.com on 18 Aug 2011 at 6:58

@GoogleCodeExporter
Copy link
Author

Okay I had a little downtime so I used it to see if I could spot what's going 
on.  I'm not sure if the version here 
http://monitores.googlecode.com/svn/trunk/1.0.1/functions.cpp is the latest 
1.0.1b or 1.0.1, but I'm sure it's similar enough that if it's not 1.0.1b for 
you to see what I'm talking about.

In PauseMediaPrograms() on lines 699~713 you definitely check that Winamp is 
playing before you attempt to send the pause command to it and set a flag, 
PAUSED_WINAMP, to indicate that monitores itself paused it.  Then in 
ResetMediaRunning() on lines 751~768 you check to make sure that Winamp is 
paused and that the aforementioned flag has been set before sending the play 
command to it and resetting the flag.  This works nicely.

As for the way Spotify and iTunes are controlled, since there is no such check 
for the player's state and no flag set and checked for in PauseMediaPrograms() 
and ResetMediaRunning(), monitores calls each player's respective Control*() 
function unconditionally which in turn check's the state only to send the 
players the opposite command of it's current state.  i.e. paused?  play!  
playing?  pause!

You do have ControlTunesOnLock() and ControlTunesReset() that look like they'd 
fill the gap for correct iTunes control with little or no modification, but I 
don't see them being called from anywhere.

You don't have either of those functions defined for Spotify, but I'm sure it 
wouldn't take you long to make and use them ;)

I haven't checked how any of the other media players are handled, so the same 
might need to be applied to one or more of those handlers if they exhibit the 
same behavior.

Original comment by stars...@gmail.com on 18 Aug 2011 at 9:48

@GoogleCodeExporter
Copy link
Author

Thanks @starsonh, I fixed that one for iTunes in the latest version ( not yet 
released ). The problem with spotify is it's not yet available in India ( my 
country ). that's why I am not able to work on it.

Also I am busy with other work and hardly find any time for this 
development.I'll soon release the final version.

Once again Thanks for looking into the issue and reporting it back here.



Original comment by cumakt on 19 Aug 2011 at 12:05

@GoogleCodeExporter
Copy link
Author

I am having the same issue with WMP 12 and Windows 8.1:  If paused, music will 
start playing when I lock the screen.  Too bad as this was a handy piece of 
software.

Original comment by mtdous...@gmail.com on 21 Dec 2013 at 12:35

@GoogleCodeExporter
Copy link
Author

I've taken a look at the code and i can see why it starts playing when paused 
and you lock.

I think you need a change along these line.

void ControlTunes (bool action)
{
    HRESULT hRes;
    CoInitialize ( 0 );
    IiTunes *iITunes = 0;
    hRes = ::CoCreateInstance ( CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER, IID_IiTunes, ( PVOID * ) & iITunes );
    if ( hRes == S_OK && iITunes )
    {
        ITPlayerState iIPlayerState;
        iITunes->get_PlayerState ( &iIPlayerState );
        if(iIPlayerState == ITPlayerStatePlaying && action == 0)
        {
            iITunes->Pause();
        } else if (iIPlayerState == ITPlayerStateStopped && action == 1)
        {
            iITunes->Play();
        }
        iITunes->Release();
    }
    CoUninitialize();
}

void PauseMediaPrograms()
{
if (IDC_PAUSE_MEDIA_FLAG)
    {
      ...
        //iTunes control using COM
        HWND hwndTunes = FindWindow ( "iTunes", NULL );
        if ( hwndTunes != NULL )
            ControlTunes(0);

    }
}

void ResetMediaRunning()
{
    if (IDC_PAUSE_MEDIA_FLAG)
    {
       ...
        //iTunes control using COM
        HWND hwndTunes = FindWindow ( "iTunes", NULL );
        if ( hwndTunes != NULL )
            ControlTunes(1);
       ...
    }
}

If you can advise what you used to compile this then I could compile myself and 
test to advise if this fixes the issue.

Marcus

Original comment by linkop...@gmail.com on 3 Mar 2015 at 12:17

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants