How to upload Video to YouTube using Google API PHP Client Library and Youtube API V3?

前端 未结 2 960
庸人自扰
庸人自扰 2021-02-15 16:45

Trying to simply upload video using Google API PHP Client (latest release 1.1.6), but code in Youtube API V3 is not working and giving 500 internal server error.

What is

相关标签:
2条回答
  • 2021-02-15 17:30

    Strangely a very small tweak in code fixes the problem.

    Instead of just $videoPath = "/path/to/file.mp4"; using DOCUMENT_ROOT solves the issue. Other than that code of documentation is perfect.

    $videoPath = $_SERVER["DOCUMENT_ROOT"] . "/mapapp/videos/test.mp4";
    
    0 讨论(0)
  • 2021-02-15 17:30

    for other whoe comes around and deal with "Failed to parse Content-Range header"

    I was searching for 3 days and finaly i found my solution...

    my file was bigger then 4gb and xampp on windows (my webserver tool) is just 32bit so the fopen() command could not read my big files.

    I installaed apache 64bit and php7 64bit by my own and it is gone

    At this moment my script finaly loads chunks on big files

    794 - 07:14:15 - 832569344
    795 - 07:14:16 - 833617920
    796 - 07:14:17 - 834666496
    797 - 07:14:18 - 835715072
    798 - 07:14:19 - 836763648
    799 - 07:14:19 - 837812224
    800 - 07:14:20 - 838860800
    801 - 07:14:21 - 839909376
    802 - 07:14:22 - 840957952
    803 - 07:14:23 - 842006528
    804 - 07:14:24 - 843055104
    

    allready 804 chunks ^^ no truncate nothign :D just uploading flawless

    0 讨论(0)
提交回复
热议问题