javascript 如何从 Youtube 播放 MP4 视频?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4743416/
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-10-25 14:45:13  来源:igfitidea点击:

How to play MP4 videos from Youtube?

javascriptandroidyoutube

提问by Abi

I need to play videos from Youtube as MP4.

我需要以 MP4 格式播放来自 Youtube 的视频。

My system (an Android Phone) does not support Flash.

我的系统(Android 手机)不支持 Flash。

It can play MP4 videos.

它可以播放 MP4 视频。

So I'm thinking of creating a web page that plays videos from Youtube.

所以我想创建一个网页来播放来自 Youtube 的视频。

I need to get MP4 videos to play in my page.

我需要让 MP4 视频在我的页面中播放。

What approaches are there?

有哪些方法?

采纳答案by Junibert

Take a look at this related question, where the OP has figured out a hacky way to get the necessary ID and checksum parameters for the get_video "API". Streaming Youtube Videos

看看这个相关的问题,OP 找到了一种获取 get_video “API”的必要 ID 和校验和参数的hacky 方法。 流媒体 YouTube 视频

He successfully played back the stream in the VideoView component. You can use the fmt parameter for choosing which format you want, see wikipedia for a list: http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs

他成功地回放了 VideoView 组件中的流。您可以使用 fmt 参数来选择您想要的格式,请参阅维基百科的列表:http: //en.wikipedia.org/wiki/YouTube#Quality_and_codecs

Good luck.

祝你好运。

回答by Andrew

Did you actually try viewing videos? I have the Droid Eris, which shipped with a YouTube app. Try going to the mobile version of YouTubeand see if that works out.

你真的尝试过观看视频吗?我有一个 Droid Eris,它附带了一个 YouTube 应用程序。尝试访问移动版 YouTube,看看是否可行。

Google created Android. Google owns YouTube. Transitivity says you shouldn't have any problems.

谷歌创造了安卓。谷歌拥有 YouTube。传递性说你不应该有任何问题。

回答by Jana

Youtube provides alternative RTSP(real time streaming protocol) links for all existing videos.. dig into youtube api and try to get it. once you get it you can try code playing the video invoking the inbuilt player to play those videos

Youtube 为所有现有视频提供替代 RTSP(实时流媒体协议)链接。深入 youtube api 并尝试获取它。一旦你得到它,你可以尝试代码播放视频调用内置播放器来播放这些视频

Cheers.

干杯。

回答by Neera

Why not consider using Mobile youtube interface

为什么不考虑使用移动 youtube 界面