簡體   English   中英

如何在WPF中播放.flv文件?

[英]how to Play .flv files in WPF?

如何在WPF中播放.flv文件? 請任何人幫助我。

// Create the interop host control.
var host = new WindowsFormsHost();

// Create the ActiveX control.
var axShockwaveFlash = new AxShockwaveFlash();

// Assign the ActiveX control as the host control's child.
host.Child = axShockwaveFlash;

// Add the interop host control to the Grid
// control's collection of child controls.
this.MainGrid.Children.Add(host);

axShockwaveFlash.Location = new System.Drawing.Point(0, 0);
axShockwaveFlash.LoadMovie(0, @"C:\player.swf");
axShockwaveFlash.SetVariable("quality", "Low");
axShockwaveFlash.ScaleMode = 0;
axShockwaveFlash.AllowScriptAccess = "always";

//axShockwaveFlash.FlashVars =  @"file=C:\barsandtone.flv" + 
//&autostart=true&fullscreen=true&controlbar=none&repeat=" +
//"always&stretching=fill";

axShockwaveFlash.CallFunction("<invoke name=\"loadFLV\" " +
    "returntype=\"xml\"><arguments><string>barsandtone.flv</string>" +
    "</arguments></invoke>");

axShockwaveFlash.Play();

參考

如果要使用DirectShow,則必須使用WPFMediaKit。

使用http://www.free-codecs.com/download/K_lite_codec_pack.htm就可以了。

Max @GoTactile

如果那是使用DirectShow那么你可能只需要安裝一個編解碼器:

http://www.free-codecs.com/download/K_lite_codec_pack.htm

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM