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. Silverlight MediaElement to play video

Silverlight MediaElement to play video

Scheduled Pinned Locked Moved WPF
wpfhelptutorial
6 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 new to Silverlight application.I want to display video using Mediaelement tag and I used the below code to play video.

    And I placed that video file in Xaml folder but when i run the application i am not getting any results to play video. The steps I followed are correct or anything missed. Please help me how to play video using silverlight mediaelement and mention the steps to play video and where i have to place video to use it in mediaelement source property. Thanks in advance Pavani

    M 1 Reply Last reply
    0
    • P pavanip

      Hi, I am new to Silverlight application.I want to display video using Mediaelement tag and I used the below code to play video.

      And I placed that video file in Xaml folder but when i run the application i am not getting any results to play video. The steps I followed are correct or anything missed. Please help me how to play video using silverlight mediaelement and mention the steps to play video and where i have to place video to use it in mediaelement source property. Thanks in advance Pavani

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

      AVI files aren't currently supported for MediaElement AFAIK. Try converting the AVI to WMV :) Also, if you're going to use a relative URI like that, make sure the media file is in the same folder as the contents of the Silverlight app's XAP. Mark

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

      P 1 Reply Last reply
      0
      • M Mark Salsbery

        AVI files aren't currently supported for MediaElement AFAIK. Try converting the AVI to WMV :) Also, if you're going to use a relative URI like that, make sure the media file is in the same folder as the contents of the Silverlight app's XAP. Mark

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

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

        thanks for your reply. I tried with all files but if i give weblink like "http://silverlight.services.live.com/82169/Blend1/video.wmv" in source property its working. And if I use local file either it is avi or wmv file its not working. Can you please tell me where to place my video and how to call that video in source property.

        M 1 Reply Last reply
        0
        • P pavanip

          thanks for your reply. I tried with all files but if i give weblink like "http://silverlight.services.live.com/82169/Blend1/video.wmv" in source property its working. And if I use local file either it is avi or wmv file its not working. Can you please tell me where to place my video and how to call that video in source property.

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

          You need to use a proper URI for the MediaElement Source. If you use

          Source="a_video.wmv"

          then that's a relative URI so a_video.wmv needs to be in your Silverlight app's XAP. You could add the file to your project and set its Build Action to "Content" and set Copy to Output Directory to copy the file. For local files you need an absolute URL, something like

          Source="File://c:/somefolder/a_video.wmv"

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

          P 1 Reply Last reply
          0
          • M Mark Salsbery

            You need to use a proper URI for the MediaElement Source. If you use

            Source="a_video.wmv"

            then that's a relative URI so a_video.wmv needs to be in your Silverlight app's XAP. You could add the file to your project and set its Build Action to "Content" and set Copy to Output Directory to copy the file. For local files you need an absolute URL, something like

            Source="File://c:/somefolder/a_video.wmv"

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

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

            thank you its working now I added reference to my video in app's XAP folder. I used the Relative URI source='/a_video.wmv' I have one doubt here I created silvetlight project now i want to create webapplication and i want to use silverlight media elements etc and for web application where i have to place my video to play. please help me if you know and how to host silverlight projects?

            M 1 Reply Last reply
            0
            • P pavanip

              thank you its working now I added reference to my video in app's XAP folder. I used the Relative URI source='/a_video.wmv' I have one doubt here I created silvetlight project now i want to create webapplication and i want to use silverlight media elements etc and for web application where i have to place my video to play. please help me if you know and how to host silverlight projects?

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

              pavanip wrote:

              where i have to place my video to play

              Depends on your requirements. You can place the files anywhere they are accessible by URI, or bundled with the application. You may not want to deliver large media in your app because the user would have to wait for it to download before the app even runs. You could, however, make a separate xap to hold media resources.

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

              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