Android Question Exoplayer Youtube Dash

Erel

Administrator
Staff member
Licensed User
It doesn't matter. The long url works. I've just tested it:
B4X:
sources.Add(player1.CreateDashSource("https://manifest.googlevideo.com/api/manifest/dash/mm/31/mn/sn-jjjpa-ua8e/id/o-APfz9Vyd_6uCFgmQvD7i4VPYvn_hVMWfBjTFBs2zfO5J/mt/1484545841/sparams/as,hfr,id,initcwndbps,ip,ipbits,itag,mm,mn,ms,mv,pcm2cms,pl,playback_host,requiressl,source,expire/mv/m/ms/au/ip/5.144.60.34/as/fmp4_audio_clear,webm_audio_clear,webm2_audio_clear,fmp4_sd_hd_clear,webm2_sd_hd_clear/playback_host/r1---sn-jjjpa-ua8e.googlevideo.com/hfr/1/pl/24/upn/LagJhAtaOlQ/source/youtube/expire/1484567634/pcm2cms/yes/ipbits/0/signature/86DA4825B2E3B1B0313C0BC2E41B391FE23AEDAC.0ACF62D058ED34122672F3A7E999689D121E8CA6/itag/0/key/yt6/requiressl/yes/initcwndbps/1797500"))
 
Upvote 0

Leni Berry

Active Member
Licensed User
1. Find dashmpd=
2. Find the next &
3. Now URLDecode the substring once or twice (test it).

is it possible to get the link using httpjob like this?

B4X:
Dim j As HttpJob
   
    j.Initialize("urlstream", Me)
   
    j.Download2("http://www.youtube.com/get_video_info",Array As String("video_id",videoid))

because if i follow the link above through the browser it always download "get_video_info" file.
 
Upvote 0

Leni Berry

Active Member
Licensed User
Yes, it is possible. You need to parse the response as explained in post #4.

with this code :
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    'https://www.youtube.com/watch?v=cgxWP4Wu77s
    Dim j As HttpJob
    Dim videoid As String="=cgxWP4Wu77s"
   
    j.Initialize("youtube", Me)
    j.Download2("https://www.youtube.com/watch",Array As String("v",videoid))
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub JobDone(job As HttpJob)
    Log(job)
    Log(job.GetString)
    job.Release
End Sub

the output is not the same with file downloaded when access through browser...

how can i parse the content?
 
Upvote 0

Leni Berry

Active Member
Licensed User
with this code :
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    'https://www.youtube.com/watch?v=cgxWP4Wu77s <--- for watching video
    'http://www.youtube.com/get_video_info?&video_id=cgxWP4Wu77s <--- for getting video_info file
    Dim j As HttpJob
    Dim videoid As String="cgxWP4Wu77s"
   
    j.Initialize("youtube", Me)
    j.Download2("http://www.youtube.com/get_video_info",Array As String("video_id",videoid))
   
End Sub

Sub JobDone(job As HttpJob)
    Log(job)
    Log(job.GetString)
    File.WriteString(File.DirRootExternal,"get_video_info_job.txt",job.GetString)
    job.Release
End Sub

i can get "get_video_info_job.txt" file for manually open and check "dashmpd=". but i can't get that string pattern on the file.. even in "get_video_info.txt" file that i get manually from http://www.youtube.com/get_video_info?&video_id=cgxWP4Wu77s via browser....
 

Attachments

  • get_video_info_job.txt
    37.7 KB · Views: 421
  • get_video_info.txt
    37 KB · Views: 431
Upvote 0

DonManfred

Expert
Licensed User
Is there a way to play youtube with this player?
Read the thread first.
Basically no. Seems you need to find the right url to the stream....
 
Upvote 0

G-ShadoW

Active Member
Licensed User
more easy way to find direct youtube link is to use VLC
youtube direct stream works ok

  1. Find a video on YouTube and copy the URL from the address bar.
  2. In VLC, head to Media > Open Network Stream.
  3. Paste the YouTube link in the box and click Play.
  4. Under Tools, click Codec Information.
  5. In the box that says Location, right-click the block of text and click Select All. Copy this text to your clipboard.

    sources.Add(player1.CreateUriSource("youtube link")
 
Last edited:
Upvote 0
Top