Does anybody have any ideas on embedding a video in a web form then when the user clicks pause, I would like to put a time stamp into my database. When the user unpauses, then again I want to put another time stamps into my database. I found this article,
but again have been unsuccessful on having onclick events being called.
<html>
<head>
</head>
<body>
<form>
<OBJECT ID="Player" height="0" width="0"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
</OBJECT>
<INPUT TYPE="BUTTON" NAME="BtnPlay" VALUE="Play" OnClick="StartMeUp()">
<INPUT TYPE="BUTTON" NAME="BtnStop" VALUE="Stop" OnClick="ShutMeDown()">
<INPUT TYPE="BUTTON" NAME="BtnPause" VALUE="Pause" OnClick="Pause()">
<SCRIPT>
<!--
function StartMeUp() {
document.getElementById('Player').URL = "Halo.mp3";
}
function ShutMeDown() {
document.getElementById('Player').Controls.stop();
}
function Pause(){
document.getElementById('Player').Controls.Pause();
// Do an AJAX call to insert the current date and time to the DB
}
-->
</SCRIPT>
</form>
</body>
</html>
Since the pause event is running on client, you will need AJAX to do the DB insertion. Also, I don't think pausing would need to cause a server side event.
TheDirtyBird
Participant
806 Points
339 Posts
Embedded Video with onclick functionality.
Apr 30, 2012 07:50 PM|LINK
Does anybody have any ideas on embedding a video in a web form then when the user clicks pause, I would like to put a time stamp into my database. When the user unpauses, then again I want to put another time stamps into my database. I found this article, but again have been unsuccessful on having onclick events being called.
http://stackoverflow.com/questions/8380011/asp-net-embeded-video-player-with-database-connectivity
Any help and advice would be much appricated.
Ruchira
All-Star
42888 Points
7020 Posts
MVP
Re: Embedded Video with onclick functionality.
May 01, 2012 11:37 AM|LINK
Hello,
See the below sample code
<html> <head> </head> <body> <form> <OBJECT ID="Player" height="0" width="0" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> </OBJECT> <INPUT TYPE="BUTTON" NAME="BtnPlay" VALUE="Play" OnClick="StartMeUp()"> <INPUT TYPE="BUTTON" NAME="BtnStop" VALUE="Stop" OnClick="ShutMeDown()"> <INPUT TYPE="BUTTON" NAME="BtnPause" VALUE="Pause" OnClick="Pause()"> <SCRIPT> <!-- function StartMeUp() { document.getElementById('Player').URL = "Halo.mp3"; } function ShutMeDown() { document.getElementById('Player').Controls.stop(); } function Pause(){ document.getElementById('Player').Controls.Pause(); // Do an AJAX call to insert the current date and time to the DB } --> </SCRIPT> </form> </body> </html>Since the pause event is running on client, you will need AJAX to do the DB insertion. Also, I don't think pausing would need to cause a server side event.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.ramiramilu
All-Star
95285 Points
14072 Posts
Re: Embedded Video with onclick functionality.
May 01, 2012 11:43 AM|LINK
if you go to Silverlight you can handle Play and pause events - http://simplesilverlight.wordpress.com/2008/04/02/create-a-video-player-silverlight-2-part-1/
in those button click events, make a call to WCF Service and then from there insert to Database (in WCF WebMethods)...
Thanks,
JumpStart