在通用 C# 中播放 youtube 音乐

playing youtube music in universal C#

我正在使用 windows universal 为 windows phone 制作一个应用程序。该应用程序将从磁盘播放音乐并从 link 流式传输音乐。我的用户希望能够使用 YouTube link 并在他们的 phone.

上播放视频的音乐

这可能吗?

我正在使用 Backgroundmediaplayer to be able to turn the screen off and still keep it playing. Basicaly, I need to convert a youtube link into a valid MediaSource

Youtube 不允许获取 music/video 的直接 link 来使用它们。您需要使用 Webview 来显示您的内容,但如果是视频,您可能会看到在真实视频之前出现的广告。

除了@thomas-lebrun的回答,根据ToS of YouTube API,禁止将任何内容的音频和视频组件分开。

separate, isolate, or modify the audio or video components of any YouTube audiovisual content made available through the YouTube API;