how to Play .flv files in WPF?

六月ゝ 毕业季﹏ 提交于 2019-12-21 05:15:12

问题


How to Play .flv files in WPF? please anyone help me out.


回答1:


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

Reference:

  • Hosting Flash movie in a WPF project
  • Hosting Flash Movie in WPF (Part 2): Some ‘Strictly Microsoft Technology Please’ options



回答2:


If you want to use DirectShow, you must use WPFMediaKit.

With http://www.free-codecs.com/download/K_lite_codec_pack.htm it will be ok.

Max @GoTactile




回答3:


If thats using DirectShow then you probably just need a codec installed:

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



来源:https://stackoverflow.com/questions/689110/how-to-play-flv-files-in-wpf

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