How to play MP4 (H.264 video) in Silverlight 3 (or 4) from a URL?

巧了我就是萌 提交于 2019-12-02 06:14:05

问题


So I have some URL of an MP4 file. I want to develop a simple Silverlight application to play it.

How to do it? (Preferably with example code.)


回答1:


Ole Jak,

Here is a suggested step-by-step:

Step 1: Create a sample Silverlight application with Visual Studio (File / New Project / Silverlight Application

Step 2: In your newly create project, edit the MainPage.xaml, and place the following code inside the UserControl's Grid

<MediaElement Stretch="Uniform" Grid.Row="0" Width="400" Height="300"
     AutoPlay="true"
     Name="x_Media"
     Source="http://silverlightatlanta.net/Firestarter/Videos/TimHeuer_2.mp4" />

Step 3: Build and Run!

Jim




回答2:


The mp4 file you trying to play does not contains moov header. That way, the player need the complete file to start playing. I recomend that you run mp4box on the file to include moov headers.



来源:https://stackoverflow.com/questions/1966215/how-to-play-mp4-h-264-video-in-silverlight-3-or-4-from-a-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!