Hallo,
ich habe ein kleinen TV-Browser entwickelt der sich mit VDR (siehe www.vdrportal.de) verbindet und die angeklicke Sender streamen kann...
nur weiß ich nicht ob das so richtig ist bzw. bin mir nicht sicher ob ich als Anfänger die function() wirklich verstanden habe, sieht:
Code:
<html>
<head>
<link href='style.css' type='text/css' rel='stylesheet' />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1>VDR</h1>
<?php
include('svdrp.php');
date_default_timezone_set('Europe/Berlin');
$fb = new SVDRP();
$fb->Connect();
$liste = $fb->ListChannels();
$stream_host = "192.168.2.140";
$port = "3000";
$ts = "TS";
$zahl = 0;
function player($s_link, $jetzt, $danach, $sender, $info, $uhr_j, $uhr_d) {
echo "<div id='player'>";
echo "<h2>$sender</h2>";
echo "<object width='725' height='350' type='video/x-msvideo'>
<param name='FileName' value='http://" . $s_link . "'>
<embed type='application/x-mplayer2' src='http://" . $s_link . "'>
</embed>
</object><br>";
echo "<table>
<tr>
<td>
<b class='jetzt'>$uhr_j</b><b class='epg_jetzt'> $jetzt</b>
<br>
<b class='danach'>$uhr_d</b><b class='epg_danach'> $danach</b>
</td>
</tr>
</table>";
echo "<div id='info'>$info</div>";
echo "</div>";
}
echo "<div id='senderliste'>";
echo "<h2>Senderliste</h2>";
for($i = 1; $i <= 40; $i++) {
$epg_1 = $fb->Command("LSTE $i NOW");
$epg_2 = $fb->Command("LSTE $i NEXT");
// Uhrzeit
//jetzt:
$uhr_j = split(" ", $epg_1[1]);
$uhr_j = $uhr_j[2];
$uhr_j = date("H:i",$uhr_j);
//danach:
$uhr_d = split(" ", $epg_2[1]);
$uhr_d = $uhr_d[2];
$uhr_d = date("H:i",$uhr_d);
//Uhrzeit ENDE
echo "<pre>";
$data = split(" ", $epg_1[0]);
$sender = $data[2];
if (isset($data[3])) {
$sender = $data[2] . " " . $data[3];
if (isset($data[4])) {
$sender = $data[2] . " " . $data[3] . " " . $data[4];
}
}
//EPG jetzt und danach holen
$jetzt = substr($epg_1[2], 2);
$danach = substr($epg_2[2], 2);
$info = "";
if (isset($epg_1[3])) {
$info = substr($epg_1[3], 2);
}
if (isset($epg_1[4])) {
$info .= substr($epg_1[4], 2);
}
$play = "$stream_host:$port/$ts/$data[1]";
echo "<table>
<form method='POST'>
<input type='hidden' name='JETZT' value='$jetzt' />
<input type='hidden' name='DANACH' value='$danach' />
<input type='hidden' name='INFO' value='$info' />
<input type='hidden' name='PLAY' value='$play' />
<input type='hidden' name='UHR_J' value='$uhr_j' />
<input type='hidden' name='UHR_D' value='$uhr_d'/>
<tr>
<td>
<input type='submit' name='SENDER' value='$sender' /><br>
<b class='jetzt'>$uhr_j</b><b class='epg_jetzt'> $jetzt</b><br>
<b class='danach'>$uhr_d</b><b class='epg_danach'> $danach</b>
</td>
</tr>
</form>
</table>";
}
echo "</div>";
if (isset($_POST['SENDER'])) {
player($_POST['PLAY'], $_POST['JETZT'], $_POST['DANACH'], $_POST['SENDER'], $_POST['INFO'], $_POST['UHR_J'], $_POST['UHR_D']);
}
$fb->Disconnect();
?>
</body>
</html>
das ganze sieht dann so aus:
es funktioniert, nur ob das so richtig ist daran zweifele ich (vorallem das mit function und mit <form... if (isset($_POST['SENDER'])).... $_POST etc.)?
LG, Roki
Lesezeichen