May 14, 2015
114 Views

Player video picasa with youtube player

Written by

Bước 1: Lấy link video picasa dựa vào RSS:

Ví dụ: http://redirector.googlevideo.com/videoplayback?id=e72b617775f4e090&itag=5&source=picasa&cmo=sensitive_content%3Dyes&ip=0.0.0.0&ipbits=0&expire=1401870838&sparams=id,itag,source,ip,ipbits,expire&signature=7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889&key=lh1

(Link trên sẽ hết hạn theo thời gian, link chỉ có giá trị minh họa.
Hoặc bạn có thể lấy link tại RSS sau:

http://picasaweb.google.com/data/entry/api/user/116918391913616722990/albumid/6012960367881032401/photoid/6012960371327767570?prettyprint=true

Bước 2: Giải mã URL (url decode) vừa lấy được

Ta được: http://redirector.googlevideo.com/videoplayback?id=e72b617775f4e090&itag=5&source=picasa&cmo=sensitive_content=yes&ip=0.0.0.0&ipbits=0&expire=1401870838&sparams=id,itag,source,ip,ipbits,expire&signature=7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889&key=lh1

Bước 3: Sửa tất cả & thành &

Ta được: http://redirector.googlevideo.com/videoplayback?id=e72b617775f4e090&itag=5&source=picasa&cmo=sensitive_content=yes&ip=0.0.0.0&ipbits=0&expire=1401870838&sparams=id,itag,source,ip,ipbits,expire&signature=7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889&key=lh1

Bước 4: Mã hóa (url encode) giá trị của “params”

Ta được: http://redirector.googlevideo.com/videoplayback?id=e72b617775f4e090&itag=5&source=picasa&cmo=sensitive_content=yes&ip=0.0.0.0&ipbits=0&expire=1401870838&sparams=id%2Citag%2Csource%2Cip%2Cipbits%2Cexpire&signature=7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889&key=lh1

Bước 5: Mã hóa toàn bộ đường link (url encode)

 Ta được: http%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3De72b617775f4e090%26itag%3D5%26source%3Dpicasa%26cmo%3Dsensitive_content%3Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1401870838%26sparams%3Did%252Citag%252Csource%252Cip%252Cipbits%252Cexpire%26signature%3D7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889%26key%3Dlh1

Bước 6: Gắn link vừa hoàn chỉnh thay thế cho XXXXXXXXXX ở code sau:
Code:

<EMBED 
style="WIDTH: 910px; HEIGHT: 588px" width=910 height=588
type=application/x-shockwave-flash
wmode="opaque" scale="noScale" bgcolor="#fff" allowscriptaccess="always"
allowfullscreen="true"
src=https://www.youtube.com/get_player?enablejsapi=1
flashvars="fmt_list=22/1280x720/9/0/115,5/426x240/7/0/0&fmt_stream_map=22%7XXXXXXXXXX&video_id=huyannet&t=1&ps=picasaweb&auth_timeout=86400000000&playerapiid=uniquePlayerId&fs=1&hl=vi&autoplay=1&autohide=1&controls=1&cc_load_policy=0&modestbranding=1&rel=1&version=3"/>

Ta được:

<EMBED 
style="WIDTH: 910px; HEIGHT: 588px" width=910 height=588
type=application/x-shockwave-flash
wmode="opaque" scale="noScale" bgcolor="#fff" allowscriptaccess="always"
allowfullscreen="true"
src=https://www.youtube.com/get_player?enablejsapi=1
flashvars="fmt_list=22/1280x720/9/0/115,5/426x240/7/0/0&fmt_stream_map=22%7http%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3De72b617775f4e090%26itag%3D5%26source%3Dpicasa%26cmo%3Dsensitive_content%3Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1401870838%26sparams%3Did%252Citag%252Csource%252Cip%252Cipbits%252Cexpire%26signature%3D7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889%26key%3Dlh1&video_id=huyannet&t=1&ps=picasaweb&auth_timeout=86400000000&playerapiid=uniquePlayerId&fs=1&hl=vi&autoplay=1&autohide=1&controls=1&cc_load_policy=0&modestbranding=1&rel=1&version=3"/>

* Quan sát trong code:
Đoạn đó được chia thành 2 phần tương ứng với dộ phân giải màn hình của 2 video:
Thông số cho link video 1: 22/1280×720/9/0/115
Thông số cho link video 2: 5/426×240/7/0/0
– Ví dụ ở link video 1:
22 là số thứ tự tương ứng với link video
1280×720 là độ phân giải màn hình của video
9/0/115 là tỉ lệ màn hình, bạn nào chuyên encode video thì sẽ rõ.

* Giả sử bạn muốn thêm 2 link video với độ phân giải khác nhau thì làm như sau:

<EMBED 
style="WIDTH: 910px; HEIGHT: 588px" width=910 height=588
type=application/x-shockwave-flash
wmode="opaque" scale="noScale" bgcolor="#fff" allowscriptaccess="always"
allowfullscreen="true"
src=https://www.youtube.com/get_player?enablejsapi=1
flashvars="fmt_list=22/1280x720/9/0/115,5/426x240/7/0/0&fmt_stream_map=22%7http%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3De72b617775f4e090%26itag%3D5%26source%3Dpicasa%26cmo%3Dsensitive_content%3Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1401870838%26sparams%3Did%252Citag%252Csource%252Cip%252Cipbits%252Cexpire%26signature%3D7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889%26key%3Dlh1,5%7http%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3De72b617775f4e090%26itag%3D5%26source%3Dpicasa%26cmo%3Dsensitive_content%3Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1401870838%26sparams%3Did%252Citag%252Csource%252Cip%252Cipbits%252Cexpire%26signature%3D7B3729E5732AE2399FF2AB5A539229E06E3ED6B5.4A5B6DD9D3CD5F10C973B48C822A56AC27875889%26key%3Dlh1&video_id=huyannet&t=1&ps=picasaweb&auth_timeout=86400000000&playerapiid=uniquePlayerId&fs=1&hl=vi&autoplay=1&autohide=1&controls=1&cc_load_policy=0&modestbranding=1&rel=1&version=3"/>

 

DEMO

<embed 
style="WIDTH: 910px; HEIGHT: 588px" width=910 height=588
type=application/x-shockwave-flash
wmode="opaque" scale="noScale" bgcolor="#fff" allowscriptaccess="always"
allowfullscreen="true"
src=https://www.youtube.com/get_player?enablejsapi=1
flashvars="fmt_list=22/1280x720/9/0/115,5/426x240/7/0/0&fmt_stream_map=22%7INSERT_URL_ENCODE_HERE&video_id=huyannet&t=1&ps=picasaweb&auth_timeout=86400000000&playerapiid=uniquePlayerId&fs=1&hl=vi&autoplay=1&autohide=1&controls=1&cc_load_policy=0&modestbranding=1&rel=1&version=3">

 

 

 

 

 

Article Tags:
· · · · ·
Article Categories:
Code/Web
    http://linholiver.com

    https://linholiver.com/diary/about/