如何将 youtube 视频嵌入 WPF MediaElement 并保存视频?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12184268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 05:09:10  来源:igfitidea点击:

how do I embed a youtube video into a WPF MediaElement and save the video?

c#wpfyoutubeembedmediaelement

提问by user2186481

Is there a way to embed a youtube video into a MediaElement and save the video? I know that once you have an object inside your application you can have some sort of control over it(I think). If I'm correct, is it possible to save the youtube video once it is embedded inside the MediaElement? Thanks.

有没有办法将 YouTube 视频嵌入 MediaElement 并保存视频?我知道,一旦您的应用程序中有一个对象,您就可以对其进行某种控制(我认为)。如果我是对的,是否可以在将 youtube 视频嵌入到 MediaElement 中后保存它?谢谢。

回答by Sebastian Edelmeier

Youtube videos are not available as files, as they are streams. that makes it a bit hard to save them (Actually you can, JDownloader does that, but that's infringement of YT terms), but for playback, check this guide.

Youtube 视频不能作为文件提供,因为它们是流。这使得保存它们有点困难(实际上您可以,JDownloader 会这样做,但这违反了 YT 条款),但要进行播放,请查看本指南

回答by user2186481

You can use webcontrol for it. set the source property to use the embed link of the video. it will work fine.

您可以使用 webcontrol。设置 source 属性以使用视频的嵌入链接。它会正常工作。

<WebBrowser Source="https://www.youtube-nocookie.com/embed/W152nHe9rkM?rel=0&amp;showinfo=0" />