Permalink
Browse files

Add One-Click install of JW Player to backend web setup.

LongTail Video has given consent for MythTV to provide a One-Click
install button for users to install JW Player.  JW Player's
adaptiveProvider.swf provides HTTP Live Streaming support in
flash-capable browsers.

'3rd Party Software' -> 'JW Player' on the web setup menu.

The 'Install JW Player' button will download and install a .zip
package containing JW Player and the adaptiveProvider.swf.
The .zip contents are installed under ~/.mythtv/3rdParty/JW_Player/

LongTail Video has also given permission for MythTV to redistribute
the player, so the .zip is downloaded from MythTV directly, not
from LongTail Video.
  • Loading branch information...
1 parent 867d96a commit d41ef68373a1a75bd7497a6d2ba31e217cded16b @cpinkham cpinkham committed Jan 22, 2012
View
49 mythtv/html/3rdParty/jwplayer.qsp
@@ -0,0 +1,49 @@
+<h3>JW Player&trade; by LongTail Video</h3>
+<a href='http://www.longtailvideo.com/players/'>JW Player&trade;</a>
+is a Flash &amp; HTML5 Video Player for FLV, H.264, MP3 and YouTube Videos.<br>
+<a href='http://www.mythtv.org'>MythTV</a> uses JW Player via MythWeb and
+the mythbackend webserver to allow HTTP Live Streaming playback of
+recordings and videos.<br>
+<br>
+<h3>Installation Process</h3>
+The 'Install JW Player' button will download and install a ZIP archive containing JW Player<br>
+and the JW Player adaptiveProvider.swf plugin to support HTTP Live Streaming playback.<br>
+<!--
+You do not have to install the ZIP file on your MythWeb server, MythWeb will access<br>
+these files via the mythbackend webserver.<br>
+-->
+<br>
+<h3>Licensing</h3>
+The player is licensed under a
+<a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons License</a>.<br>
+A JW Player license is required if you are using this product for one of the following reasons:<br>
+<li>You are a business / corporation, etc.</li>
+<li>You are running ads on your site</li>
+<li>You want to remove the JW Watermark in the video player</li>
+<br>
+If you are unsure whether you need to purchase a license, please <a href="http://www.longtailvideo.com/support/contact-us">contact LongTail Video</a>.<br>
+
+<%
+ var content = new Content();
+
+ var hash = content.GetHash("3rdParty", "JW_Player/player.swf");
+
+ if (hash == "")
+ {
+%>
+<h3>JW Player&trade; is <b>not</b> installed.</h3>
+<input type=button value='Install JW Player' onClick='installPackage("jwplayer.zip"); loadContent("/3rdParty/jwplayer.qsp");'><br>
+<%
+ }
+ else
+ {
+%>
+<h3>JW Player&trade; is installed.</h3>
+<input type=button value='Re-Install JW Player' onClick='installPackage("jwplayer.zip"); loadContent("/3rdParty/jwplayer.qsp");'><br>
+<%
+ }
+%>
+
+<!--
+<input type=button value='Test JW Player installation' onClick='alert("Testing JW Player");'><br>
+-->
View
24 mythtv/html/js/util.qjs
@@ -44,6 +44,30 @@ function putSetting(hostname, key, value) {
return result;
}
+function installPackage(packageName) {
+ var result = 0;
+
+ setStatusMessage("<i18n>Installing</i18n> " + packageName);
+
+ $.ajaxSetup({ async: false });
+ $.post("/Config/InstallPackage",
+ { package: packageName },
+ function(data) {
+ if (data.Result == "true") {
+ result = 1;
+ }
+ });
+ $.ajaxSetup({ async: true });
+
+ if (result) {
+ setStatusMessage("<i18n>Package installed</i18n>");
+ } else {
+ setErrorMessage("<i18n>Unable to install package.</i18n>");
+ }
+
+ return result;
+}
+
function loadDiv(divName, contentURL, jsURL) {
divName = "#" + divName;
View
5 mythtv/html/menu.qsp
@@ -78,6 +78,11 @@
</li>
</ul>
</li>
+ <li><a href='#'><i18n>3rd Party Software</i18n></a>
+ <ul class="acitem collapsible">
+ <li><a class='menuitem' href='#' onClick="javascript:loadContent('/3rdParty/jwplayer.qsp')"><i18n>JW Player&trade;</i18n></a></li>
+ </ul>
+ </li>
</ul>
<br>
<center><a class='menuitem' href='http://www.mythtv.org'>www.mythtv.org</a></center>
View
1 mythtv/libs/libmythbase/storagegroup.cpp
@@ -69,6 +69,7 @@ void StorageGroup::StaticInit(void)
m_builtinGroups["Themes"] = GetConfDir() + "/themes";
m_builtinGroups["Temp"] = GetConfDir() + "/tmp";
m_builtinGroups["Streaming"] = GetConfDir() + "/tmp/hls";
+ m_builtinGroups["3rdParty"] = GetConfDir() + "/3rdParty";
QMap<QString, QString>::iterator it = m_builtinGroups.begin();
for (; it != m_builtinGroups.end(); ++it)
View
29 mythtv/programs/mythbackend/httpconfig.cpp
@@ -12,6 +12,8 @@
#include "mythdb.h"
#include "mythdirs.h"
#include "storagegroup.h"
+#include "mythdownloadmanager.h"
+#include "mythcoreutil.h"
HttpConfig::HttpConfig() : HttpServerExtension("HttpConfig", QString())
{
@@ -147,6 +149,33 @@ bool HttpConfig::ProcessRequest(HTTPRequest *request)
request->FormatFileResponse(fn);
return true;
}
+ else if ((request->m_sMethod == "InstallPackage") &&
+ (request->m_mapParams.contains("package")))
+ {
+ QString package = QUrl::fromPercentEncoding(request->m_mapParams["package"].toUtf8());
+ QString url = QString("http://www.mythtv.org/ftp/3rdParty/%1").arg(package);
+ StorageGroup tmpGroup("Temp", gCoreContext->GetHostName());
+ QString tmpFile = tmpGroup.GetFirstDir(true) + "package.zip";
+ StorageGroup destGroup("3rdParty", gCoreContext->GetHostName());
+ QString outDir = destGroup.GetFirstDir();
+
+ QString result = "false";
+ if ((GetMythDownloadManager()->download(url, tmpFile)) &&
+ (extractZIP(tmpFile, outDir)))
+ {
+ result = "true";
+ }
+
+ QTextStream os(&request->m_response);
+ os << StringListToJSON("Result", QStringList(result));
+
+ request->m_eResponseType = ResponseTypeOther;
+ request->m_sResponseTypeText = "application/json";
+ request->m_mapRespHeaders[ "Cache-Control" ] =
+ "no-cache=\"Ext\", max-age = 0";
+
+ return true;
+ }
else if ((request->m_sMethod == "FileBrowser") &&
(request->m_mapParams.contains("dir")))
{

0 comments on commit d41ef68

Please sign in to comment.