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

时间:2009-03-27 09:47:12

标签: wpf flash

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

3 个答案:

答案 0 :(得分:3)

// 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();

<强>参考

答案 1 :(得分:1)

如果要使用DirectShow,则必须使用WPFMediaKit。

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

Max @GoTactile

答案 2 :(得分:-1)

如果那是使用DirectShow那么你可能只需要安装一个编解码器:

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