<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Damien wrote:
<blockquote
cite="mid:6df580e50912100822i70bde11ao4fb25696ce802540@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; 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>
</blockquote>
You didnt transpose properly.....<br>
<br>
I see a couple issues:<br>
<br>
_VLC = new VideoLan.VideoLanClient(_VLCPath, optsdebug); <-- I
specify the path, you do not<br>
<br>
<br>
VideoLan.VlcMedia mx = _vlc.NewMedia(fn);
<br>
<br>
and<br>
<br>
VideoLan.VlcMediaPlayer cplayer = _VLC.NewMediaPlayer(playwindow);
<br>
<br>
I derive my COM objects directly from the instantiated _VLC.<br>
<br>
You derive them as NEW and point to _VLC... I am not sure if this could
be posing an issue or not (one would think not, but then again it is
just code...... and could have a bug)<br>
<br>
**** and lastly... the big one: *****<br>
<br>
Player player = new Player(_VLC);<br>
<br>
you should be using playwindow(the handle to your window) here:<br>
<br>
Player player = new Player(playwindow);<br>
<br>
<br>
<br>
<br>
shawn<br>
<br>
</body>
</html>