基于VLC的Unity视频播放器(四)
上篇文章中提到的问题
播放某个m3u8地址时会嘎掉,想办法解决了一下,很粗暴的,先SetFormat,再Stop,最后再Play,能用……
if (player != null && player.GetSize() == 0)
{player.GetSize((w, h) =>{width = w;height = h;aspectRatio.aspectRatio = (float)width / (float)height;});player.SetFormat();player.Stop();player.Play();yield break;
}
加上了Android平台的lib,播放也正常
Ubuntu24.04 编辑器播放正常,但打包出来闪退
先标记一下,待解决后更新此处
25.6.4 发现编辑器也运行也崩溃,搜索发现https://code.videolan.org/videolan/LibVLCSharp/blob/master/docs/linux-setup.md
[DllImport("libX11", CallingConvention = CallingConvention.Cdecl)]
public static extern int XInitThreads();#if UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUXLibVLC.XInitThreads();
#endif
sudo apt install libx11-dev
但是播放此链接http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear2/prog_index.m3u8 在编辑器之外运行依然会因为ffmpeg codec报错而崩溃
项目迁移到了 https://github.com/xue-fei/vlc-unity
https://github.com/xue-fei/vlc-unity
因为我的码云快炸裂了……