简体   繁体   中英

how to Play .flv files in WPF?

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

// 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 :

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM