1
我的應用中有此功能,用戶可以使用gdrive共享鏈接添加視頻。我上傳了gdrive中的視頻,然後創建了一個可共享的鏈接。在上傳表單中粘貼該鏈接,然後添加視頻。我需要驗證三件事 -如何從gdrive共享鏈接獲取視頻大小/格式/訪問權
- 格式必須是MP4
- 提供文件訪問或不
- 文件大小超過25MB
以下是我的代碼 -
var link = videoUrl;
if (link.indexOf('drive') != -1) {
var gdrive = link.replace('/view?usp=sharing', '').replace('open?id=', 'uc?export=download&id=').replace('file/d/', 'uc?export=download&id=').replace('/edit?usp=sharing', '');
videoUrl = gdrive;
}
var videoelement = createVideoElement(videoUrl);
createVideoElement = function(url) {
var element = document.createElement('video');
element.src = url;
element.width = '400';
element.height = '200';
element.controls = true;
element.autoplay = 'autoplay';
return element;
};
我試圖添加的示例視頻可共享 - https://drive.google.com/open?id=0B31psA0C98iFNl9ScWRESTBxalk
我已經使用過fileupload,我很熟悉如何驗證上傳的文件大小。但在這裏,因爲它是gdrive鏈接不知道如何實現它。
'video.duration'是持續時間?或視頻大小 –