How to play video based on some value?
-
Hi , i am using the following code in html to play videos in media player. But i want to give the filename based on the value present in radiobuttonlist. But how to do this? I am confused. Any help ?
Chaitra N
-
Hi , i am using the following code in html to play videos in media player. But i want to give the filename based on the value present in radiobuttonlist. But how to do this? I am confused. Any help ?
Chaitra N
http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=3602#18305
function play(media){
document.getElementById('mediaplayer').innerHTML=
'<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'
+'type="application/x-oleobject" width="320" height="285">'
+'<param name="showControls" value="false">'
+'<param name="fileName" value="'+media+'">'
+'<embed type="application/x-mplayer2" width="320" height="285"'
+'showcontrols="false" src="'+media+'"><\/embed><\/object>'
}Add this to the CSS:
#mediaplayer {
width: 320px;
height: 285px;
background: #000;
}And put this in the html where you want the videos to play and menu:
<div id="mediaplayer"></div>
<ul id="menu">
<li><a onclick="play("mymovie1.wmv");return false" href="">Movie 1</a></li>
<li><a onclick="play("mymovie2.wmv");return false" href="">Movie 2</a></li>
</ul>Note that OBJECT tag won't work on Firefox. Edit: Text editor is really bad for posting code.. Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=3602#18305
function play(media){
document.getElementById('mediaplayer').innerHTML=
'<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'
+'type="application/x-oleobject" width="320" height="285">'
+'<param name="showControls" value="false">'
+'<param name="fileName" value="'+media+'">'
+'<embed type="application/x-mplayer2" width="320" height="285"'
+'showcontrols="false" src="'+media+'"><\/embed><\/object>'
}Add this to the CSS:
#mediaplayer {
width: 320px;
height: 285px;
background: #000;
}And put this in the html where you want the videos to play and menu:
<div id="mediaplayer"></div>
<ul id="menu">
<li><a onclick="play("mymovie1.wmv");return false" href="">Movie 1</a></li>
<li><a onclick="play("mymovie2.wmv");return false" href="">Movie 2</a></li>
</ul>Note that OBJECT tag won't work on Firefox. Edit: Text editor is really bad for posting code.. Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Hi Michael, The code i sent is working fine but i want it to get displayed based on the title present in bulletedlist. See I am storing the path of the video files in my database. I am using the following code to retrieve the path of the file. What I am finding difficult is to assign that path to the " filename " of the mediaplayer object Protected Sub Show_Products(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.BulletedListEventArgs) Handles BulletedList1.Click Dim SQLString As String = "SELECT filepath FROM pictures WHERE title = '" & BulletedList1.Items(e.Index).Text & "'" Dim dr As Data.SqlClient.SqlDataReader Dim comm As New Data.SqlClient.SqlCommand(SQLString, dbconn) If dbconn.State <> ConnectionState.Open Then dbconn.Open() End If Dim str As String dr = comm.ExecuteReader While dr.Read str = dr.Item(0) End While dr.Close() str = str End Sub