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. General Programming
  3. WPF
  4. Media Element source property in code behind

Media Element source property in code behind

Scheduled Pinned Locked Moved WPF
databasequestion
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.
  • P Offline
    P Offline
    pavanip
    wrote on last edited by
    #1

    Hi, I am developing one application in that I have more than 5 media elements. I want to assign path to media element source from database.For that I have created one silverlight application and there is a ClientBin in silverlight website, I have saved my uploaded videos in clientbin and that path in database. But from code behind if i assign the path its not showing anything. my sample code is mplayer.Source = new System.Uri(@"D:\sample\sample.Web\ClientBin\Lake.wmv", UriKind.Absolute); Can you please tell me is there any other way to assign path to source property or what is the mistake I have done in that code. Thanks in Advance Pavani

    M 1 Reply Last reply
    0
    • P pavanip

      Hi, I am developing one application in that I have more than 5 media elements. I want to assign path to media element source from database.For that I have created one silverlight application and there is a ClientBin in silverlight website, I have saved my uploaded videos in clientbin and that path in database. But from code behind if i assign the path its not showing anything. my sample code is mplayer.Source = new System.Uri(@"D:\sample\sample.Web\ClientBin\Lake.wmv", UriKind.Absolute); Can you please tell me is there any other way to assign path to source property or what is the mistake I have done in that code. Thanks in Advance Pavani

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      pavanip wrote:

      mplayer.Source = new System.Uri(@"D:\sample\sample.Web\ClientBin\Lake.wmv", UriKind.Absolute);

      You need to use URI strings that are appropriate for where the media actually is. You're showing an absolute URI for aaa place on a hardrive - the client knows nothing about a D drive, nor does it have access to its D drive. Besides, your media is on the server, not on the client. Here's a good article that should have what you need to know: Different ways for loading images and files in Silverlight 2 applications [^]

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      P 1 Reply Last reply
      0
      • M Mark Salsbery

        pavanip wrote:

        mplayer.Source = new System.Uri(@"D:\sample\sample.Web\ClientBin\Lake.wmv", UriKind.Absolute);

        You need to use URI strings that are appropriate for where the media actually is. You're showing an absolute URI for aaa place on a hardrive - the client knows nothing about a D drive, nor does it have access to its D drive. Besides, your media is on the server, not on the client. Here's a good article that should have what you need to know: Different ways for loading images and files in Silverlight 2 applications [^]

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        P Offline
        P Offline
        pavanip
        wrote on last edited by
        #3

        thank you for your response.I resolved my problem by using mplayer.source=("Lake.wmv",UriKind.Relative) and I placed my video in web project ClientBin folder and directly using just video name.

        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