这是我的浏览页面。我必须根据我的文件格式播放mpeg,mp4,mkv文件,这些文件存储在foreach循环中。不要工作。 Plesae帮助我如何实现这个?我必须在我的视图页面上播放所有这三种文件格式。
<div style="width:98%;float:left; height:auto;margin:0 1%;">
@foreach (string vidf in Model.SVideo)
{
string[] arr = new string[@Model.SVideo.Count()];
string ss = @vidf.ToString();
arr = @vidf.Split('.');
string ext =arr[1];
if (ext != "mpeg")
{
<div style="width:295px;display:inline-block;margin:10px 5px;">
<video width="320" height="240" poster="poster.jpg" controls="controls" preload="none">
<source type="video/mp4" src="@vidf" />
<track kind="subtitles" src="subtitles.srt" srclang="en" />
<track kind="chapters" src="chapters.srt" srclang="en" />
</video>
</div>
}
else
{
<object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows® Media Player components..." type="application/x-oleobject" width="280" height="256">
<param name="fileName" value="@vidf">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="Volume" value="-450">
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="@vidf" name="MediaPlayer1" width=280 height=256 autostart=1 showcontrols=1 volume=-450>
</object>
}
}
</div>