Re: [問題] 新手問題js
試了一下,不順利,後來想到好像有這件事
Google Drive 檔案外連功能將於 2016 年 8 月關閉, 站長須即早準備
http://www.wfublog.com/2016/04/google-drive-disable-direct-link.html
不過我都弄了,還是貼一下好了
http://codepen.io/not0000/pen/NdzXPe
左邊html只是把該放的js放一放而已,不太重要
右邊前面var obj那一大塊都是你的google driver點下去的內容
捲到下面就會看到obj[0]['file']在取得json的值,我有把取到的值印到連結上
確認可正常取到json資料
但正常要從url取json的話,可以用$.getJSON的方式取,如下
$.getJSON('http://api.getlinkdrive.com/get....總之很長的url',
function(data) {
//在這邊依照上面的範例,用data[0]['file']就能取到資料了
var VideoUrl = data[0]['file'];
});
但是因為google擋外連了,所以按F12會看到錯誤訊息
No 'Access-Control-Allow-Origin' header is present on the requested resource.
因此..換空間吧
※ 引述《tregfd654321 (B.Milk)》之銘言:
: 好吧,小弟真的爬文爬很久了,所以才上來問,對js真的不會,所以上來問
: 小弟目前在用
: google drive影片
: 用videojs播放器播出來的
: 影音網頁
: 小弟的code是這樣
:
: <video id='example_video_1' class="video-js
: vjs-default-skin"width="1385"></video>
: <script>
: videojs('example_video_1', {
: controls: true,
: plugins: {
: videoJsResolutionSwitcher: {
: default: 'high', // Default resolution [{Number}, 'low', 'high'],
: dynamicLabel: false
: }
: }
: }, function(){
: var player = this;
: window.player = player
: player.updateSrc
: (
: /*需要插入的外部網址的地方*/
: )
: player.on('resolutionchange', function(){
: console.info('Source changed to %s', player.src())
: })
: })
: </script>
: https://goo.gl/IYeus6圖片好讀,請問要怎麼把drive轉出來的連結code
: https://goo.gl/1Cf21h加入到上面的code裡面呢
: p.s為什麼不直接把網頁裡面的code複製到裡面呢,因為他code每段時間會變。
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.187.101.186
※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1486308699.A.C42.html
推
02/06 00:16, , 1F
02/06 00:16, 1F
討論串 (同標題文章)
Web_Design 近期熱門文章
PTT數位生活區 即時熱門文章