<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Try this code please:<br>
<br>
(1. _VLC is a local global/private variable)<br>
(2. Change the appropriate opts items to match yours)<br>
(3. Call Initialize)<br>
(4. Call PlayVideo (filename,windowhandle,""))<br><br></blockquote><div><br></div><div>I have copied your code (altering it to match bindings in vlc git). Here it is :</div><div>--8<----8<----8<----8<----8<----8<--</div>
<div> public partial class Form1 : Form</div><div> {</div><div> private VLC _VLC;</div><div> private bool _VLCDebug;</div><div> private string _VLCPath;</div><div> private string _VLCPluginPath;</div>
<div> private bool _IsRunning = false;</div><div><br></div><div> internal Form1(string vlcPath, string vlcPlugins)</div><div> {</div><div> InitializeComponent();</div><div> this._VLCPath = vlcPath;</div>
<div> this._VLCPluginPath = vlcPlugins;</div><div> }</div><div><br></div><div> private void Form1_Shown(object sender, EventArgs e)</div><div> {</div><div> this.Initialize(true);</div>
<div> this.PlayVideo("D:\\a.avi", this.Handle, string.Empty);</div><div> }</div><div><br></div><div> public bool Initialize(bool DebugOn)</div><div> {</div><div> _VLCDebug = DebugOn;</div>
<div> string[] opts = { "-I", "dummy", "--plugin-path=" + _VLCPluginPath, "--one-instance" };</div><div> string[] optsdebug = { "-I", "dummy", "--plugin-path=" + _VLCPluginPath, "-vvv", "--extraintf=logger", "--logfile=D:\\VlcLog.txt" };</div>
<div> try</div><div> {</div><div> if (_VLCDebug)</div><div> {</div><div> _VLC = new VLC(optsdebug);</div><div> }</div><div> else</div>
<div> {</div><div> _VLC = new VLC(opts);</div><div> }</div><div> _IsRunning = true;</div><div> }</div><div> catch (Exception ex)</div><div>
{</div><div> _IsRunning = false;</div><div> }</div><div> return _IsRunning;</div><div> }</div><div><br></div><div> private void PlayVideo(string fn, IntPtr playwindow, string EncodeOption)</div>
<div> {</div><div> Media mx = new Media(_VLC, fn);</div><div> if (!string.IsNullOrEmpty(EncodeOption))</div><div> mx.AddOptions(EncodeOption, true);</div><div> //Note: You may set playwindow = intptr.zero, which will just encode your file/not show it</div>
<div> Player player = new Player(_VLC);</div><div> player.Media = mx;</div><div> this.Text = mx.Location;</div><div> mx.Dispose();</div><div> player.Play();</div><div>
}</div><div> }</div><div>--8<----8<----8<----8<----8<----8<--</div></div><br><div><br></div><div>Running from VS2008 debugger :</div><div> - Media.Location returns a bad string (libvlc_media_get_mrl)</div>
<div> - AccessViolationException when calling LibVLC.PlayerPlay().</div><div><br></div><div>Running from commandline with mono :</div><div> - Media.Location is good</div><div> - crashes at PlayerPlay() too.</div><div><br>
</div><div>Thanks for trying to help.</div><div><br></div><div>Damien</div>