// elapsed time to a file. Without this trick we have no way to find out // the end of this script. // forward declaration for timer class ... $sTimer = NULL; // are we in archive play ... ? if (!$dorec && $gmt != -1) { // create timer class ... $sTimer = new CArchTimer(); // is any offset given ... if ($offset != 0) { // get last stop timestamp ... if (($lastStamp = $sTimer->getLastStopTime()) === false) { // can't get timestamp --> use given gmt to proceed with offset ... $gmt += $offset; } else { simpleLog(__FILE__ . ":" . __LINE__ . " gmt: " . $gmt . ", LastStop: " . $lastStamp . ", Offset: " . $offset . ", gmt new: " . ($lastStamp + $offset)); // got last timestamp --> compute new gmt // using last stop stamp with offset ... $gmt = $lastStamp + $offset; } } // start measurement ... $sTimer->start($gmt); } // get stream url ... $url = $kartAPI->getStreamUrl($cid, $gmt); if ($url != "") { $url_array = parse_url($url); $host = $url_array['host']; $path = isset($url_array['path']) ? $url_array['path'] : "/"; $port = isset($url_array['port']) ? (int) $url_array['port'] : 80;
function _pluginCreatePlayRewind($cid, $gmt, $isVideo) { $retMediaItems = array(); // forward / rewind values ... $offSetSecs = "-600, -300, -120, -60, 0, 60, 120, 300, 600"; // create array from values ... $offSetArr = explode(", ", $offSetSecs); // master play item array ... $play_data = array('cid' => $cid, 'gmt' => $gmt, 'is_video' => $isVideo, 'dorec' => false, 'offset' => 0); // fill list with all array entries ... for ($i = 0; $i < count($offSetArr); $i++) { // update offset time ... $play_data['offset'] = (int) $offSetArr[$i]; // get offset in minutes ... $offInMins = (int) $offSetArr[$i] / 60; // build http query ... $play_data_query = http_build_query($play_data); // rewind / forward or simple play ... if ($offInMins < 0) { $title = "- " . abs($offInMins) . " мин."; $icon = LOC_KARTINA_URL . "/images/clock.png"; } else { if ($offInMins > 0) { $title = "+ " . $offInMins . " мин."; $icon = LOC_KARTINA_URL . "/images/clock.png"; } else { $title = "Старт Просмотр"; $icon = LOC_KARTINA_URL . "/images/play.png"; } } simpleLog(__FUNCTION__ . "():" . __LINE__ . " Add \"" . $offInMins . " min.\" Play Item (cid=" . $cid . ", is_video=" . $isVideo . ", dorec=false)"); // add play item ... $retMediaItems[] = array('id' => LOC_KARTINA_UMSP . "/kartina?" . urlencode(md5($play_data_query)), 'dc:title' => $title, 'upnp:class' => $isVideo ? "object.item.videoitem" : "object.item.audioitem", 'res' => LOC_KARTINA_URL . "/http-stream-recorder.php?" . $play_data_query, 'protocolInfo' => "http-get:*:*:*", 'upnp:album_art' => $icon); } return $retMediaItems; }