dongxi7609 2018-06-26 23:39 采纳率: 0%
浏览 74


I am trying to setup a youtube upload for one of my own projects. I am using the sample code from google that can be found here:

The script to upload videos works perfectly fine. My only problem is the following:

I would like to offer multiple areas for the upload or multiple uploads in other words.

There is the general file that contains the sign-in button and the video upload itself. This file will be loaded into a DIV-container via Ajax. Loading the file works fine as well. The only problem is, that the sign-in button wont show up if the file was being loaded via ajax.

It seems to me that i would have to initialize the api again but even after searching the web for hours i could not fint anything. All i know is, that the following code is loaded by the api automatically:

googleApiClientReady = function() {
    gapi.auth.init(function() {
        window.setTimeout(checkAuth, 1);

So i think i need to figure out a way, how to load that function again once the ajax-call is finished. I just can not figure out how. Every time i try to call this function the browser gives me a gapi.client error message.

Does anybody have experience with the youtube api? What am i doing wrong here? Thanks

  • 写回答

1条回答 默认 最新

  • dqan70724 2018-06-27 15:46

    The answer would be in this line:

    UploadVideo.prototype.handleUploadClicked = function() {
      $('#button').attr('disabled', true);

    If this function is called after uploading and getting the video data, it will disable the upload button. Just remove that line and you'll be able to upload multiple videos.

    Hope this helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 prism提示我reinstall prism 如何解决
  • ¥15 asp.core 权限控制怎么做,需要控制到每个方法
  • ¥20 while循环中OLED显示中断中的数据不正确
  • ¥15 这个视频里的stm32f4代码是怎么写的
  • ¥15 JNA调用DLL报堆栈溢出错误(0xC00000FD)
  • ¥15 请教SGeMs软件的使用
  • ¥15 自己用vb.net编写了一个dll文件,如何只给授权的用户使用这个dll文件进行打包编译,未授权用户不能进行打包编译操作?
  • ¥50 深度学习运行代码直接中断
  • ¥20 需要完整的共散射点成像代码
  • ¥15 编写vba代码实现数据录入工作