使用ExoPlayer将YouTube实时视频(DASH)流传输到Android应用 [英] Streaming a YouTube live video (DASH) to Android app with ExoPlayer

查看:348
本文介绍了使用ExoPlayer将YouTube实时视频(DASH)流传输到Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个可以将实时YouTube视频流式传输到我的应用程序的应用程序.我想使用ExoPlayer.我浏览了ExoPlayer的演示应用程序,它们在DASH流中使用的URL是这样的:

I am making an app that can stream a live YouTube video to my app. I want to use ExoPlayer. I went through the demo app of ExoPlayer, and the URL they use in DASH streaming is something like this :

"uri":"http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source ,id,as& ip = 0.0.0.0& ipbits = 0& expire = 19000000000& signature = 51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E& key = ik0"

这正在工作.

我不知道如何获取这样的URL,我最终在此处.这是否意味着即使视频是我自己的,我也无法从YouTube流式传输吗? (尤其是实时视频),如果我能如何为我的视频获得这样的URL?

I don't know how to get such a URL and I end up here. Does that mean that I can't stream from YouTube even if the video is my own? (especially Live videos) If I can how can I get such a URL for my video?

推荐答案

我了解到DASH URL实际上是Google内部的东西,您可能需要使用解码器才能获取URL.

I have learned that DASH URLs are actually something that are internal to Google and you might need to use decoder to be able to get your URL.

为此,您可能需要尝试Karim Abdell Salam在此

For this, you may want to try the following solution given by Karim Abdell Salam in this SO post:

  1. 首先,您需要调用以下URL:http://www.youtube.com/get_video_info?&video_id=v1uyQZNg2vE,并且不要忘记将目标ID更改为最后一个ID.
  2. 现在,您会得到通知,下载没有扩展的名为get_video_info的文件.
  3. 尝试使用记事本等打开此文件.
  4. 现在您拥有正确的数据,但由于其已编码而无法读取,因此您需要HTML解码器才能读取此数据.使用以下命令之一:http://meyerweb.com/eric/tools/dencoder/.只需粘贴您的数据,然后按几次解码以确保解码正确
  5. 最后,搜索一个名为dashmpd的密钥并享受您的URL
  1. First you need to call this url: http://www.youtube.com/get_video_info?&video_id=v1uyQZNg2vE and don't forget to change the last id with the target one.
  2. Now you will get notice to download a file called get_video_info with no extesion.
  3. Try to open this file using notepad and so.
  4. Now you have the right data but you can't read it because its encoded You need HTML decoder to read this data. Use this one: http://meyerweb.com/eric/tools/dencoder/. Just paste your data and press decode a several times to ensure it decoded well
  5. Finally, search for a key called dashmpd and enjoy your URL

您可能还需要检查以下链接,以获取更多有用的信息和更新:

You may want to also check these links for more helpful information and updates:

  • YouTube video regarding ExoPlayer: Adaptive video streaming on Android
  • AndroidDev blog - Using ExoPlayer to play Youtube videos, don't know where the example URL's in the demo app are coming from.
  • ExoPlayer Release Notes

最后,您可能也选择尝试在Android 4.2.2版上播放实时视频,而不必使用此

Lastly, you may opt to also try playing live videos on android version 4.2.2 without necessarily using an ExoPlayer as mentioned in this SO post.

这篇关于使用ExoPlayer将YouTube实时视频(DASH)流传输到Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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