【问题标题】:using youtube api with asp.net, how can I upload and record a video? [closed]使用 youtube api 和 asp.net,我如何上传和录制视频? [关闭]
【发布时间】:2023-03-05 13:14:01
【问题描述】:

我有一个 asp.net 网站,我需要用户将视频上传到 youtube 上的某个频道。

可以通过从他们的电脑上传视频或直接通过网络摄像头录制视频然后将其上传到同一频道来完成上传视频。

【问题讨论】:

    标签: c# asp.net youtube youtube-api youtube.net-api


    【解决方案1】:

    https://developers.google.com/youtube/youtube_upload_widget

    看起来他们有一个小部件:

    <!-- 1. The 'widget' div element will contain the upload widget.
         The 'player' div element will contain the player IFrame. -->
    <div id="widget"></div>
    <div id="player"></div>
    
    <script>
      // 2. Asynchronously load the Upload Widget and Player API code.
      var tag = document.createElement('script');
      tag.src = "//www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    
      // 3. Define global variables for the widget and the player.
      //    The function loads the widget after the JavaScript code
      //    has downloaded and defines event handlers for callback
      //    notifications related to the widget.
      var widget;
      var player;
      function onYouTubeIframeAPIReady() {
        widget = new YT.UploadWidget('widget', {
          width: 500,
          events: {
            'onUploadSuccess': onUploadSuccess,
            'onProcessingComplete': onProcessingComplete
          }
        });
      }
    
      // 4. This function is called when a video has been successfully uploaded.
      function onUploadSuccess(event) {
        alert('Video ID ' + event.data.videoId + ' was uploaded and is currently being processed.');
      }
    
      // 5. This function is called when a video has been successfully
      //    processed.
      function onProcessingComplete(event) {
        player = new YT.Player('player', {
          height: 390,
          width: 640,
          videoId: event.data.videoId,
          events: {}
        });
      }
    </script>
    

    【讨论】:

      猜你喜欢
      • 2018-08-10
      • 2011-05-13
      • 1970-01-01
      • 1970-01-01
      • 2012-12-23
      • 2015-09-18
      • 2012-10-27
      • 2011-06-22
      • 1970-01-01
      相关资源
      最近更新 更多