Unable to play media with vlc ocx

亡梦爱人 提交于 2019-12-11 02:39:26

问题


I want to embed the vlc media player in a .NET application I've found a lot of solutions

  1. VLC .Net interface <- didn't work with me
  2. wrappers for dll functions <>
  3. http://vlcdotnet.codeplex.com this is nice
  4. the activex of VLC - i really liked to use it it must be less bugs and errors but errors found

I found 2 controls "VLC ActiveX plugin and IE web plugin v1" , "VLC ActiveX plugin and IE web plugin v2" What is the difference between them?? i dragged and dropped the fist one and used the following code

axVLCPlugin1.addTarget(@"D:\video\English\10,000.b.c\10000bc.rmvb", null, AXVLC.VLCPlaylistMode.VLCPlayListAppendAndGo, -666);
axVLCPlugin1.play();

that had no effect i dragged and dropped the second one and used the following code

axVLCPlugin21.playlist.add(@"D:\video\English\10,000.b.c\10000bc.rmvb");
axVLCPlugin21.playlist.play();
//i also tried this
axVLCPlugin21.playlist.playItem(0);

also it had no effect

I didn't found many details and documentations of the VLC OCX what is the error ?


回答1:


The v1 of the ActiveX is deprecated and v2 is primarily for browser integration thus not intended to be used like you tried...

Use http://vlcdotnet.codeplex.com/ - this is a well-working library...




回答2:


It might be the file format. I also tried to use these two ActiveX controls to play media files in a MFC application. It worked with .avi and mp3 format, did not work with mp4 format. And if I remember it correctly, VLC does not have the codecs for .rmvb format in itself by default because of some copyright problem.




回答3:


The solution is simple: you need an uri, not a normal path

This:

var uri = new Uri(@"D:\video\English\10,000.b.c\10000bc.rmvb");
var converted = uri.AbsoluteUri;
axVLCPlugin21.playlist.add(converted);

There you go.




回答4:


The plugin (v1 and v2) works fine in c#.net. v2 is better.

You need to use "file:///" before the link:

axVLCPlugin1.addTarget(@"file:///D:\video\English\10,000.b.c\10000bc.rmvb", null, AXVLC.VLCPlaylistMode.VLCPlayListAppendAndGo, -666);


来源:https://stackoverflow.com/questions/9709277/unable-to-play-media-with-vlc-ocx

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