【问题标题】:What would be the path of my video using php我的视频使用 php 的路径是什么
【发布时间】:2014-07-15 00:58:17
【问题描述】:

我正在尝试使用 api 上传到 youtube。 我在设置视频路径时遇到了一点问题。我想指定一个 url 作为路径,例如:http://mywebsite.com/videos/myvideo.flv

这就是我所做的。

  $fileName = "myvideo.flv";    
  $fileType = "video/flv";   
  $newEntry = new Zend_Gdata_YouTube_VideoEntry();  
  $filesource = $yt->newMediaFileSource('http://mywebsite.com/videos/myvideo.flv');  
  $filesource->setContentType('video/flv');  
  $filesource->setSlug($fileName);   
  $newEntry->setMediaSource($filesource);  
  $newEntry->setVideoTitle("VIDEO TITLE");   
  $newEntry->setVideoDescription("VIDEO DESCRIPTION");   
  $newEntry->setVideoCategory("Comedy");   
  $newEntry->setVideoTags("VIDEO TAGS");   

虽然我将文件权限设置为 755,但现在我收到此错误消息:

Array
(
[data] => Array
    (
        [flag] => 
        [msg] => File to be uploaded at http://mywebsite.com/videos/myvideo.flv does not exist or is not readable.
    )

)

谢谢罗比。你的伎俩奏效了。我只需要指定我的网站主机的正确路径。

【问题讨论】:

  • 如果有效,请点击勾选将答案标记为已接受的答案。

标签: php api youtube


【解决方案1】:

不要指定 URL,而是指定文件系统上文件的完整路径。

另请注意,YouTube API v2 自 2014 年 3 月起已被 Google 正式弃用。可在 here 找到 v3 中用于视频上传的 PHP 代码示例。同样在 v3 中,您需要指定文件路径而不是 URL。

【讨论】:

    猜你喜欢
    • 2015-05-21
    • 2011-01-27
    • 2021-12-05
    • 1970-01-01
    • 1970-01-01
    • 2017-12-26
    • 1970-01-01
    • 2016-10-15
    • 2020-10-30
    相关资源
    最近更新 更多