I got the FF and RR working, somehow, but it's slow and if I keep the RR or FF on too long, live5555 RTSP server crashes.
I tried to adjust the play speed but to no avail. I did find out however that the KeyAction() function isn't being called though. I should at least get the alert("XYXYXYX"); popping up on screen but this doesn't happen.
I checked my code and it looks OK to me, like other similar coding I've seen. What's also strange is that the function handle_event() works very well and when Live5555 crashes gives me the correct RTSP has failed message on screen. Only the KeyAction() function doesn't fire up. Hmmm.
My code is below, I can't see where the error might be:
<HTML>
<HEAD>
<title> IPTV IP-STB </title>
<meta http-equiv="Keywords" content="VoD implementation">
<meta http-equiv="Content-Type" content="text/html charset="us-ascii" lang="en">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<link rel="stylesheet" type="text/css" href="../IPSTB.css" />
<aminoattr tcr="#00ff00" UNLOADVIDEO="no" notoolbar hidepointer />
<script type="text/javascript">
function keyAction(e)
{
alert("XYXYXYX");
var keypressed = e.which;
var rtn = true;
switch(keypressed)
{
case 307:
//ASTB.SetKeyFunction(307, 32 ); //Play key
rtn = false;
break;
case 312:
//ASTB.SetKeyFunction(312, 34 ); //Pause key
rtn = false;
break;
case 308:
alert("FF");
AVMedia.SetSpeed(25);
//ASTB.SetKeyFunction(308, 37 ); //FF key
rtn = false;
break;
case 310:
alert("RR");
AVMedia.SetSpeed(-25);
//ASTB.SetKeyFunction(310, 38 ); //RR key
rtn = false;
break;
case 305:
//ASTB.SetKeyFunction(305, 40 ); //Mute key
rtn = false;
break;
case 303:
//ASTB.SetKeyFunction(303, 41 ); //Volume up key
rtn = false;
break;
case 304:
//ASTB.SetKeyFunction(304, 42 ); //Volume down key
rtn = false;
break;
default:
alert("unhandled key press: "+keypressed);
break;
}
}
//document.onkeypress = keyAction();
</script>
</HEAD>
<BODY onkeypress="keyAction(event);">
<amino fgalpha="5">
<script type="text/javascript">
function handle_event()
{
videostatus = AVMedia.Event;
eventString = AVMedia.EventString;
switch (videostatus)
{
case 0:
break; //undefined status
case 1:
alert("RTSP CONNECT FAILED (1) "+eventString);
break;
case 2:
alert("RTSP SEND FAILED (2) "+eventString);
break;
case 3:
alert("RTSP READ FAILED (3) "+eventString);
break;
case 4:
alert("RTSP CONNECTION DIED (4) "+eventString);
break;
case 6:
break;
case 7:
if (eventString.search("2104"))
{
break;
}
else
{
alert("RTSP status ANNOUNCE (7) "+eventString);
break;
}
case 8:
if (continuous)
{
document.simple.information.value = ("RTSP status END OF STREAM "+eventString + "restarting..") ;
PlayLoop();
}
else
{
alert("RTSP status END OF STREAM "+eventString);
}
break;
case 9:
alert("RTSP status NOT FOUND (9) "+eventString);
break;
case 10:
alert("status NO VIDEO (10) "+eventString);
break;
case 11:
alert("IGMP status END-OF-STREAM (11) "+eventString);
break;
case 12:
alert("RTSP CONNECTION STOPPED (12) "+eventString);
break;
case 13:
alert("RTSP status AUTHENTICATE (13)");
break;
case 14:
alert("RTSP status REDIRECTED (14)");
break;
case 15:
alert("IGMP status PLAYING (15)");
break;
case 16:
alert("UDP status END OF STREAM (16)");
break;
case 17:
alert("UDP status PLAYING (17)");
break;
case 18:
alert("MP3S_STATUS_END_OF_STREAM (18)");
break;
case 19:
alert("AUD_DESCRIP_READY (19)");
break;
case 20:
alert("RTSP_STATUS_START_OF_STREAM (20)");
break;
case 21:
alert("MP3S_STATUS_START_OF_STREAM (21)");
break;
case 22:
alert("RTSP_STATUS_ANNOUNCE_PARTIAL (22)");
break;
case 23:
<!--alert("STATUS_PMT_CHANGED (23)");-->
break;
case 24:
alert("PVRS_STATUS_PLAYING (24)");
break;
case 25:
alert("PVRS_STATUS_END_OF_STREAM (25)");
break;
case 31:
alert("WEBFETCH_STARTED (31)");
break;
case 32:
alert("WEBFETCH_CONNECT_FAILED (32)");
break;
case 33:
alert("WEBFETCH_START_STREAMING (33)");
break;
case 34:
alert("WEBFETCH_END_OF_STREAM (34)");
break;
case 36:
alert("WEBFETCH_KILLED (36)");
break;
default:
break;
}
}
</script>
<script type="text/javascript">
var videostatus = 0 ;
var eventString = "some textual data" ;
var continuous = 1 ; //loop video
ASTB.SetMouseState(false);
VideoDisplay.SetAlphaLevel(0);
VideoDisplay.SetAspect(0);
VideoDisplay.SetAVAspect(0);
VideoDisplay.FullScreen(1);
AVMedia.onEvent = "handle_event();" ;
AVMedia.Play('type=VOD;servertype=ncube;src=rtsp://<IP address>/bttf1.ts');
</script>
</BODY>
</HTML>