标签: video-upload

在react.js中上传后如何从onChange函数获取视频时长

我想在 react.js 上传后从 onChange 函数获取视频时长。我已经在 stackblitz 中分享了我的代码。链接在这里 -工作演示

我在代码中提到我需要获取视频时长。我在 onchange 函数的reader.onloadend部分需要它。这是我在以下部分给出的代码:

import React, { Component } from 'react';
import { render } from 'react-dom';
import Hello from './Hello';
import './style.css';

class App extends Component {
  constructor() {
    super();
    this.state = {
      name: 'React',
      get_video: '',
      videoAttribute: []
    };
  }

  chosenVideo(e) {
        e.preventDefault();

        /*this.setState({
            file_state: e.target.files[0]
        });*/

        var file = e.target.files[0];
        var file_state = e.target;
        var reader = new FileReader();
        reader.onloadend = () => {
            this.setState({
                get_video: reader.result, …
Run Code Online (Sandbox Code Playgroud)

javascript onchange filereader reactjs video-upload

2
推荐指数
1
解决办法
5816
查看次数

YouTube Data API v3:无需打开浏览器即可从服务器上传视频

我每天尝试从我的服务器上传视频到我的帐户,但浏览器无法访问。我可以在我的桌面上执行此操作,通过运行下面提到的脚本打开浏览器,请求我的权限并完成上传视频所需的完整授权,然后上传视频。

python upload_video.py --file clips/concatenated.mp4 --title testing --desc empty_dec

/Users/devansh.dalal/Desktop/hackathon/tiktoki/venv/lib/python3.7/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access upload_video.py-oauth2.json: No such file or directory
  warnings.warn(_MISSING_FILE_MESSAGE.format(filename))

Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?client_id=73183172161-48495o1tqgjgih3v7j218av2bghdcm30.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.upload&access_type=offline&response_type=code

If your browser is on a different machine then exit and re-run this
application with the command-line parameter

  --noauth_local_webserver

Authentication successful.
Uploading file...
Run Code Online (Sandbox Code Playgroud)

但我想要一个不需要手动授权脚本的解决方案,因为我的服务器是完全安全的。请提出建议?

oauth-2.0 youtube-data-api google-cloud-platform video-upload

1
推荐指数
1
解决办法
2533
查看次数