mediaelement 中的 UWP youtube 播放器 [英] UWP youtube player in mediaelement

查看:28
本文介绍了mediaelement 中的 UWP youtube 播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发 UWP youtube 播放器,但在播放实际视频时遇到了一些大问题.我正在使用它在媒体元素中播放 YouTube 视频:

I am currently developing an UWP youtube player and i am having some big trouble with playing the actual video. I am using this to play a youtube video in a media element:

  using MyToolkit.Multimedia;
var url = await YouTube.GetVideoUriAsync(youtubeid, YouTubeQuality.Quality1080P);
var YoutubePlayer = new MediaElement();
YoutubePlayer.Source = url.Uri;

它曾经可以正常工作大约一个月,但现在它只是......没有.它获得了正确的视频 URI(mp4),我也尝试过使用 YoutubeExtractor nuget 包,但出于某种原因,当我使用 YoutubePlayer.Play() 时,它只是不播放.它什么都不做.没有错误,没有什么.

It used to work just fine for about a month, but now it just... doesn't. It gets the right video URI (the mp4), i also tried with the YoutubeExtractor nuget package, but for some reason, when i use YoutubePlayer.Play(), it just doesn't play. It does nothing. No error, no nothing.

我找到了使用 webview 和调用 javascript 方法的自定义 C# 控件的替代方法,但我不喜欢那样做,因为使用媒体元素会更流畅.

I found an alternative of using a webview and custom C# controls that calls javascript methods, but i prefer not to go that way, since it is much smoother having a media element.

任何帮助都可以,我已经在互联网上搜索了几天,但仍然找不到答案.

Any help would do, i've been searching the internet for days now and still can't find an answer.

谢谢.

推荐答案

不久前我尝试了同样的方法,但无法让 youtubeExtractor 工作.然后我转向 LibVideo - 确实有效.

A while ago i tried the same and i couldn't get youtubeExtractor to work. I then moved on to LibVideo - which did work.

这是一个分叉的存储库,它实现了一些当时尚未接受的修复.https://github.com/sommmen/libvideo

This is a forked repo which implemented some fixes that were not accepted yet at the time. https://github.com/sommmen/libvideo

悲哀地不再维护该项目,但直到今天这仍然对我有用.

The project is no longer being maintained sadly, but this still works for me till this day.

这篇关于mediaelement 中的 UWP youtube 播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆