Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to play video based on some value?

How to play video based on some value?

Scheduled Pinned Locked Moved ASP.NET
htmlhelptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    n_gchaitra
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • N n_gchaitra

      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

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      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. :)

      N 1 Reply Last reply
      0
      • M Michael Sync

        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. :)

        N Offline
        N Offline
        n_gchaitra
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups