Make windows use flash for youtube

parent 3d27a5e1
......@@ -211,15 +211,22 @@ void SkyliveProtocol::processPackets()
QList<QString> paramlist = pkt.params.split(PARAM_SEPARATOR);
if(paramlist.size()==3)
{
//SKMessage mmsg("youtubevideo");
//QString yt("http://youtube.googleapis.com/v/");
SKMessage mmsg("openurl");
SKMessage mmsg("youtubevideo");
#if defined(Q_OS_WIN)
QString yt("http://youtube.googleapis.com/v/");
yt.append(paramlist[0]);
yt.append("?autoplay=1&start=");
yt.append(paramlist[1]);
#else
//SKMessage mmsg("openurl");
QString yt("http://www.youtube.com/embed/");
yt.append(paramlist[0]);
yt.append("?html5=1&autoplay=1&start=");
yt.append(paramlist[1]);
#endif
mmsg.parameters.insert("url", yt);
//mmsg.parameters.insert("volume", paramlist[2]);
mmsg.parameters.insert("volume", paramlist[2]);
sendMessage(mmsg);
}
}
......
......@@ -58,6 +58,7 @@ MainWin::MainWin(QString &htmlfile)
registerHandler((QString)"loginfailed", (SKHandlerFunction)&MainWin::handle_loginres);
registerHandler((QString)"openurl", (SKHandlerFunction)&MainWin::handle_openurl);
registerHandler((QString)"youtubevideo", (SKHandlerFunction)&MainWin::handle_youtubevideo);
msgsender = SENDER;
......@@ -128,3 +129,26 @@ void MainWin::handle_openurl(SKMessage &msg)
}
}
}
void MainWin::handle_youtubevideo(SKMessage &msg)
{
if(msg.handle=="youtubevideo")
{
if(msg.parameters.contains("url"))
{
std::cout << "OPEN URL " << msg.parameters["url"].toStdString() << std::endl;
//if(msg.parameters.contains("width")
//if(msg.parameters.contains("height);
WebWin *wv = new WebWin;
QWebPage *newWeb = new QWebPage(wv);
wv->setPage(newWeb);
wv->setAttribute(Qt::WA_DeleteOnClose, true);
wv->setUrl(QUrl(msg.parameters["url"]));
wv->show();
}
}
}
......@@ -63,6 +63,7 @@ class MainWin : public SkylivexWin
void handle_asklogin(SKMessage &msg);
void handle_loginres(SKMessage &msg);
void handle_openurl(SKMessage &msg);
void handle_youtubevideo(SKMessage &msg);
};
......
......@@ -57,7 +57,8 @@ WebWin::WebWin(QString &htmlfile)
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
//settings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
settings()->setAttribute(QWebSettings::PluginsEnabled, true);
QPalette pal = palette();
pal.setBrush(QPalette::Base, Qt::transparent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment