diff options
Diffstat (limited to 'pages/vlc.ecpp')
-rw-r--r-- | pages/vlc.ecpp | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/pages/vlc.ecpp b/pages/vlc.ecpp index 6245c90..aea5560 100644 --- a/pages/vlc.ecpp +++ b/pages/vlc.ecpp @@ -12,6 +12,7 @@ using namespace vdrlive; <%args> tChannelID channel; string async; + string recid; </%args> <%session scope="global"> bool logged_in(false); @@ -23,18 +24,24 @@ using namespace vdrlive; <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); - pageTitle = tr("VLC: live video stream"); - bool asyncReq = !async.empty() && (lexical_cast<int>(async) != 0); - ReadLock channelsLock(Channels); + // the availabilty of Channel signals that we will do live tv streaming. + Channel = 0; + if (recid.empty()) { + pageTitle = tr("VLC: live video stream"); + ReadLock channelsLock(Channels); - if (!channelsLock) { - throw HtmlError(tr("Couldn't aquire access to channels, please try again later.")); + if (!channelsLock) { + throw HtmlError(tr("Couldn't aquire access to channels, please try again later.")); + } + Channel = Channels.GetByChannelID(channel); + if (Channel == 0) { + throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); + } } - Channel = Channels.GetByChannelID(channel); - if (Channel == 0) { - throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); + else { + pageTitle = tr("VLC: play recording"); } </%cpp> <& pageelems.doc_type &> @@ -57,7 +64,9 @@ using namespace vdrlive; <script type="text/javascript" src="js/live/vlc.js"></script> <script type="text/javascript"><!-- var vlcControl = new VLC("video1", { - <? !asyncReq ? "autoresize: false" ?> + <? !asyncReq ? "autoresize: false," ?> + <? !Channel ? "playRecording: true," ?> + offset: 5 }); vlcControl.addEvent('toggle', function(id, state){ var text = null; @@ -85,20 +94,26 @@ using namespace vdrlive; } </%cpp> <%cpp> - if ( Channel != 0 ) { - int streamdevPort = LiveSetup().GetStreamdevPort(); -#ifdef TNTVERS7 - string server = request.getHost(); +#if TNTVERSION >= 1606 + string server = request.getHost(); + if (Channel != 0) { server = server.substr(0, server.rfind(':')); + } #else - string server = request.getServerIp(); + string server = request.getServerIp(); #endif - string videourl = string("http://") + server + ":" + lexical_cast<string,int>(streamdevPort) + "/" + LiveSetup().GetStreamdevType() + "/" + *Channel->GetChannelID().ToString(); + string videourl; + if (Channel != 0) { + int streamdevPort = LiveSetup().GetStreamdevPort(); + videourl = string("http://") + server + ":" + lexical_cast<string,int>(streamdevPort) + "/" + LiveSetup().GetStreamdevType() + "/" + *Channel->GetChannelID().ToString(); + } + else { + videourl = string("http://") + server + "/recstream.html?recid=" + recid; + } </%cpp> - <embed type="application/x-vlc-plugin" id="video1" name="video1" autoplay="yes" loop="no" width="720" height="576" target="<$ videourl $>" /> + <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org/" version="VideoLAN.VLCPlugin.2" id="video1" name="video1" autoplay="yes" loop="no" width="720" height="576" target="<$ videourl $>" /> <& vlc.controls videourl=(videourl) asyncReq=(asyncReq) &> <%cpp> - } if (!asyncReq) { </%cpp> </div> |