编程语言
首页 > 编程语言> > java-vlcj从网址播放视频

java-vlcj从网址播放视频

作者:互联网

需要vlcj播放来自url的视频,它可以处理磁盘上的文件,但是当它占用网络时-它不起作用.
测试视频:http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4

在错误中,我有此文件系统访问错误:无法打开文件/home/progsmile/Documents/dev/java/trying2/http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4(没有此类文件或目录)
[0x7f9c4801ad18]主要访问错误:文件读取失败

//here is part of code
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();

//...

String filePath = "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4";
mediaPlayer.playMedia(filePath);

请帮忙)

解决方法:

您是否尝试过首先准备mrl?

mediaPlayer.prepareMedia(filePath);
//mediaPlayer.setPlaySubItems(true);
mediaPlayer.play();

标签:vlcj,video,stream,java
来源: https://codeday.me/bug/20191027/1946627.html