Skip to content

Commit

Permalink
RemoteAPI: added mute and changed play/pause
Browse files Browse the repository at this point in the history
Fixes xbmc#805
  • Loading branch information
Tobias Hieta committed Nov 8, 2013
1 parent 2d84c77 commit c4fc907
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions plex/Client/PlexTimelineManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ CUrlOptions CPlexTimelineManager::GetCurrentTimeline(MediaType type, bool forSer
controllable.push_back("repeat");
}

controllable.push_back("mute");
controllable.push_back("volume");
controllable.push_back("stepBack");
controllable.push_back("stepForward");
Expand Down Expand Up @@ -237,6 +238,8 @@ CUrlOptions CPlexTimelineManager::GetCurrentTimeline(MediaType type, bool forSer
else
options.AddOption("repeat", 0);

options.AddOption("mute", g_application.IsMuted() ? "1" : "0");

if (type == VIDEO && g_application.IsPlayingVideo())
{
int subid = g_application.m_pPlayer->GetSubtitleVisible() ? g_application.m_pPlayer->GetSubtitlePlexID() : -1;
Expand Down
23 changes: 17 additions & 6 deletions plex/Remote/PlexHTTPRemoteHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ int CPlexHTTPRemoteHandler::HandleHTTPRequest(const HTTPRequest &request)
setStreams(argumentMap);
else if (boost::starts_with(path, "/resources"))
resources();
else if (path.Equals("/player/playback/togglePlayPause"))
pausePlay(argumentMap);
else if (path.Equals("/player/application/setText"))
sendString(argumentMap);
else if (path.Equals("/player/playback/pause"))
pausePlay(argumentMap);
else if (path.Equals("/player/playback/play"))
pausePlay(argumentMap);


#ifdef LEGACY
else if (path.Equals("/player/application/sendString"))
Expand All @@ -121,10 +124,6 @@ int CPlexHTTPRemoteHandler::HandleHTTPRequest(const HTTPRequest &request)
else if (path.Equals("/player/playback/bigStepForward") ||
path.Equals("/player/playback/bigStepBack"))
stepFunction(request.url, argumentMap);
else if (path.Equals("/player/playback/pause"))
pausePlay(argumentMap);
else if (path.Equals("/player/playback/play"))
pausePlay(argumentMap);
#endif

else
Expand Down Expand Up @@ -510,6 +509,18 @@ void CPlexHTTPRemoteHandler::set(const ArgMap &arguments)

CApplicationMessenger::Get().PlayListPlayerRepeat(playlistType, xbmcRepeat);
}

if (arguments.find("mute") != arguments.end())
{
bool mute;
try { mute = boost::lexical_cast<bool>(arguments.find("mute")->second); }
catch (boost::bad_lexical_cast) { return; }

if (g_application.IsMuted() && !mute)
g_application.ToggleMute();
else if (!g_application.IsMuted() && mute)
g_application.ToggleMute();
}
}

////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit c4fc907

Please sign in to comment.