liv/i_out.mp4 liv/ss1.mp4 liv/i_out.mp4 liv/c1g.mp4 liv/i_out.mp4 liv/vv.mp4 liv/i_out.mp4 liv/tr1be.mp4 liv/i_out.mp4 liv/sg1.mp4
# Global settings: http 80; http 8080; rtsp 554; rtmp 1935; loglevel error; logrequests true; auth http://yourchannel.ru:8080/tv/auth; pulsedb /var/run/flussonic; edit_auth login password; # DVRs: # Remote sources: # Ingest streams: stream playlist1 { url playlist://http://yourchannel.tv/pls/playlist.txt; auth false; allowed_countries ru; disallowed_countries us; domains yourchannel.tv; meta comment "yourchannel.tv server channel"; } stream tunneling { url rtmp://yourchannel.tv:1935/static/playlist1; auth false; allowed_countries ru; disallowed_countries us; domain yourchannel.tv; transcoder vb=copy; } # Dynamic rewrites: # Publish locations: # Disk file caches: # VOD locations: file vod { path priv; auth true; domain yourchannel.ru; } file liv { path /home/yourchannel/data/www/yourchannel.tv/media/liv; } # Plugins: plugin iptv { database sqlite:///opt/flussonic/priv/iptv.db; } # Includes:
<? $contents = file_get_contents('http://login:password@yourchannel.tv:8080/flussonic/api/playlist/playlist1'); print $contents; ?>
{"current_entry":"liv/c1g.mp4","current_type":"file","duration":null,"position":1739946.5416666667}
CREATE TABLE IF NOT EXISTS `media` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `media` varchar(50) NOT NULL, `duration` time NOT NULL, `next_duration` varchar(20) NOT NULL, `description` text NOT NULL, `cc` enum('yes','no') NOT NULL, `shedule_time` varchar(20) NOT NULL ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
Data.php fileView source
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <? // include ('db.php'); $userstable = "media"; $query = "SELECT * FROM $userstable ORDER by id ASC"; $result = MYSQL_QUERY($query); $number = MYSQL_NUMROWS($result); $i = 0; if ($number == 0) { print "<center><P> ..</center>"; } elseif ($number > 0) { print "<div class=\"container-fluid\"><div class=\"row\"><h4> :</h4>"; while ($i < $number) { $namer = mysql_result($result,$i,"name"); $media = mysql_result($result,$i,"media"); $duration = mysql_result($result,$i,"duration"); $description = mysql_result($result,$i,"description"); $shedule_time = mysql_result($result,$i,"shedule_time"); $contents = file_get_contents('http://yourchannel.tv/result.php'); $my_file = 'infotrack.txt'; $pfile = 'playinfo.txt'; $handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); $data = $contents; fwrite($handle, $data); $info = json_decode($contents); $name = $info->current_entry; $time = $info->position; // liv/ $fullname = substr($name, 4); // $second = $time / 1000; sscanf($duration, "%d:%d:%d", $hour, $minutes, $seconds); // $ms = $seconds * 1000 + $minutes * 60 * 1000 + $hour * 30 * 60 * 1000; $ostatok = ($ms - $second); if ($fullname == $media) { print "<a href=\"#\" class=\"list-group-item active\" title=\"".$description."\"><h4 class=\"list-group-item-heading\"><span class=\"label label-success\"> !</span> ".$namer."</h4>"; echo "<h4><i class=\"fa fa-play-circle-o\"></i>"; $estimated = gmdate("H:i:s", $second); echo $estimated; $elapsed = gmdate("H:i:s", $ostatok-25500); $conv_total_time = strtotime($duration); $conv_est_time = strtotime($estimated); $calc_time = $conv_total_time - $conv_est_time; $calctime = gmdate("H:i", $calc_time); $nowtime = time(); $next_time = $nowtime + $calc_time; $res_time = date("H:i", $next_time); echo " | <i class=\"fa fa fa-clock-o\"></i> ".$duration." <br><i class=\"fa fa-cc fa-2x\" title=\" \"></i></h4>"; echo " : ".$calctime."<br>"; echo " : ".$res_time."<br>"; print "</a> <div class=\"list-group\"> <div class=\"progress\"> <div class=\"progress-bar progress-bar-success progress-bar-striped active\" role=\"progressbar\" aria-valuenow=\"100\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 100%\"></div></div></div>"; } else { $conv_duration = strtotime($duration); $conv_res_time = strtotime($res_time); $res_final_time = $conv_duration + $conv_res_time; $res_time2 = date("H:i",$res_final_time+3600); print "<div class=\"list-group\"><a href=\"#\" class=\"list-group-item\" title=\"".$description."\"> <h4 class=\"list-group-item-heading\"><span class=\"label label-default\">".$res_time."</span> ".$namer."</h4> <p class=\"list-group-item-text\"><h5>: ".$duration." <i class=\"fa fa-cc fa-2x\" title=\" \"></i></h5></a></div>"; } $i++; } print "</center></div></div>"; } ?>
We get this look:
Now we need to make the program update updated after a certain period of time (set 15 seconds).
We write a small script:
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> var jq = $.noConflict(); // Jquery, jq(document).ready(function() { var auto_refresh = setInterval(function () { jq('#info').load('data.php'); }, 15000); // 15 }); </script> <div id="info"> , ..<br><center><i class="fa fa-refresh fa-spin fa-4x"></i></center></div> </body> </html>
While the necessary functionality is enough, the program pleases the eyes:
I will be glad to your opinion and ideas on the modernization of the program schedule.
Additional Information:
Server playlists
Preparing a file for broadcasting
Video publishing to server
Source: https://habr.com/ru/post/262755/
All Articles