我遇到了必须在 C++ 应用程序中播放 YouTube 视频的情况。
这实际上是所有相关代码:
VLC::Instance instance(0, nullptr);
VLC::Media media(instance, "https://www.youtube.com/watch?v=********", VLC::Media::FromLocation);
VLC::MediaPlayer mediaPlayer(media);
mediaPlayer.play();
我明白了
lua stream error: Couldn't descramble YouTube throttling URL parameter: data transfer will get throttled
。问题似乎出在 YouTube lua
脚本中。
我将更新版本的脚本放在应用程序根目录中,没有效果。
我已经在 VLC 中测试了 YouTube 网址(媒体 -> 打开 URL),它可以使用相同的
libvlc
、libvlccore
和 lua
脚本集。
我已经使用普通视频网址测试了我的应用程序,它可以工作。所以问题正是出在 YouTube 流提取上。
在这里找到答案https://stackoverflow.com/a/66665857/24539710
问题略有不同,但解决方案相同。