Skip to content

Commit

Permalink
MythFlashPlayer: Perform seeks based on the seek amounts of the defau…
Browse files Browse the repository at this point in the history
…lt playgroup.

Also add a mythflashplayer API for volume control, thanks to a patch from Jonatan Martens.

Refs ticket 9301.
  • Loading branch information
Robert McNamara committed Dec 7, 2010
1 parent d5a786d commit a746d46
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 12 additions & 4 deletions mythplugins/mythbrowser/mythbrowser/mythflashplayer.cpp
Expand Up @@ -10,6 +10,7 @@
#include <mythcontext.h>
#include <libmythui/mythmainwindow.h>
#include <mythuiwebbrowser.h>
#include <playgroup.h>

// mythbrowser
#include "webpage.h"
Expand All @@ -22,6 +23,9 @@ MythFlashPlayer::MythFlashPlayer(MythScreenStack *parent,
: MythScreenType (parent, "mythflashplayer"),
m_browser(NULL), m_url(urlList[0])
{
m_fftime = PlayGroup::GetSetting("Default", "skipahead", 30);
m_rewtime = PlayGroup::GetSetting("Default", "skipback", 5);
m_jumptime = PlayGroup::GetSetting("Default", "jump", 10);
qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
}

Expand Down Expand Up @@ -75,13 +79,17 @@ bool MythFlashPlayer::keyPressEvent(QKeyEvent *event)
if (action == "PAUSE")
evaluateJavaScript("play();");
else if (action == "SEEKFFWD")
evaluateJavaScript("seek(10);");
evaluateJavaScript(QString("seek(%1);").arg(m_fftime));
else if (action == "SEEKRWND")
evaluateJavaScript("seek(-10);");
evaluateJavaScript(QString("seek(-%1);").arg(m_rewtime));
else if (action == "CHANNELUP")
evaluateJavaScript("seek(60);");
evaluateJavaScript(QString("seek(%1);").arg(m_jumptime * 60));
else if (action == "CHANNELDOWN")
evaluateJavaScript("seek(-60);");
evaluateJavaScript(QString("seek(-%1);").arg(m_jumptime * 60));
else if (action == "VOLUMEUP")
evaluateJavaScript("adjustVolume(2);");
else if (action == "VOLUMEDOWN")
evaluateJavaScript("adjustVolume(-2);");
else
handled = false;

Expand Down
3 changes: 3 additions & 0 deletions mythplugins/mythbrowser/mythbrowser/mythflashplayer.h
Expand Up @@ -20,6 +20,9 @@ class MythFlashPlayer : public MythScreenType
QVariant evaluateJavaScript(const QString&);
MythUIWebBrowser* m_browser;
QString m_url;
int m_fftime;
int m_rewtime;
int m_jumptime;
};

#endif

0 comments on commit a746d46

Please sign in to comment.