Native Ajax Request----(play a video hosted on Ai Qi)

Source: Internet
Author: User
Tags iqiyi

Play Video
    $ (function () {//Video Play $ ('. Play-icon '). Click (function () {$.ajax ({type: "get", url : "Http://openapi.iqiyi.com/api/file/urllist?access_token=2.6bafb158d49f9a17119b194d603eb3f9&file_id= 5164F80E1C0D478FAAFD15C9E338BACF ", Async:true, Success:function (req) {var data = JSON  . Parse (req);                    Parses a string into a JSON object for (I-in data.data.mp4) {//for...in statement is used to iterate over an array or the properties of an object (looping over the properties of an object or a group).                    var urlstr = data.data.mp4[' 1 '];                        $.ajax ({type: "Get", Url:urlstr, Async:true,                            Success:function (req) {var str = Req.match (/data: (. *)}/) [1]  $ (' #video '). attr (' src ', json.parse (str). L);                            Add the video tag with a src attribute of $ (' #videoautoplay '). Load ();                 document.getElementById (' Videoautoplay '). Play ();       }                    });        }            }        });      Popups.open ('. Player '); });
Req was originally a string
{"Data": {"mp4": {"1": "Http://data.video.qiyi.com/videos/v1/20180103/36/5a/6d31e365c6292308a7fe46b6d27c3788.mp4?") V=1058109959&qd_src=vcl&qd_tm=1525662276507&qd_ip=de831fdf&qd_p=de831fdf&qd_sc= 30be288cb28672e74adfe5e723c5b90e&qypid=10994506209_-108527&qd_uid=0&qd_vip=0&qdv=1 "}," m3u8 ": {" 2 ":" Http://cache.m.iqiyi.com/mus/10994506209/fadbcc11149851373be730dbf64081b4/afbe8fd3d73448c9//20180103/44/ec /b7b2d1073430ecb1c0b2153b68382304.m3u8?qd_originate=tmts_py&tvid=10994506209&bossstatus=0&qd_vip=0 &px=&qd_src=null&prv=&previewtype=&previewtime=&from=&qd_time=1525662276502&qd _p=7f000001&qd_asc=f22351c8edffba8e9cb48e0f0d327bfa&qypid=10994506209_04000000001000000000_2&qd_k= e2067cc4921d2c746edbdc0c1bcd4970&isdol=0&code=2&iswb=0&vf=4aee90139d9f695316ab062335ce9154 &np_tag=nginx_part_tag&v=523768577&qypid=10994506209_-108527 "," 1 ":" http://cache.m.iqiyi.com/mus/ 10994506209/d1046718b8ef96e73f50f90632056d6b/afbe8fd3d73448c9//20180103/e6/bc/3ac1faaebae140a0ecd93d7351e7ea03.m3u8?qd_originate=tmts_py &tvid=10994506209&bossStatus=0&qd_vip=0&px=&qd_src=null&prv=&previewType=& previewtime=&from=&qd_time=1525662276502&qd_p=7f000001&qd_asc=96a87da1d54b981a2226a44ed1465d5e &qypid=10994506209_04000000001000000000_1&qd_k=e2067cc4921d2c746edbdc0c1bcd4970&isdol=0&code=2 &iswb=0&vf=e21286dfc95c1abbdbec4cc6c7129d49&np_tag=nginx_part_tag&v=523768577&qypid= 10994506209_-108527 "}}," Code ":" A00000 "}
After Json.parse () parsing

Native Ajax Request----(play a video hosted on Ai Qi)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.