Ticket #9819: mythplugins-9819-mythmusic_pause_resume_on_playback_start_and_end.patch

File mythplugins-9819-mythmusic_pause_resume_on_playback_start_and_end.patch, 1.1 KB (added by sphery, 12 years ago)

mythplugins portion of not-completely-updated version of patch referenced in comment:3

  • mythmusic/mythmusic/main.cpp

    ---
     mythmusic/mythmusic/main.cpp |   25 	25 +	0 -	0 !
     1 file changed, 25 insertions(+)
    
    old new void mythplugin_resume(void) 
    641641    wasPlaying = false;
    642642}
    643643
     644static bool wasPlaying = false;
     645
     646void mythplugin_pause(void)
     647{
     648    wasPlaying = gPlayer->isPlaying();
     649    if (wasPlaying)
     650    {
     651        gPlayer->savePosition();
     652        gPlayer->stop(true);
     653    }
     654}
     655
     656void mythplugin_resume(void)
     657{
     658    if (wasPlaying)
     659    {
     660        gPlayer->play();
     661        gPlayer->seek(gCoreContext->GetNumSetting("MusicBookmarkPosition", 0));
     662        gCoreContext->SaveSetting("MusicBookmark", "");
     663        gCoreContext->SaveSetting("MusicBookmarkPosition", 0);
     664    }
     665
     666    wasPlaying = false;
     667}
     668
    644669int mythplugin_config(void)
    645670{
    646671    gMusicData->paths = gCoreContext->GetSetting("TreeLevels");