php – 无法在Google Glass上播放视频(附件选项或捆绑选项)

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 无法在Google Glass上播放视频(附件选项或捆绑选项)脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我的黑客马拉松团队在过去12小时内一直在使用GOOGLE Glass和Mirror API来播放视频,特别是使用 PHP库.

我们已尝试将视频附加到时间轴项目,我们已尝试使用捆绑选项,但两者都不会流式传输视频.

我没有要显示错误消息,根据Google文档,我们可以看到的代码是正确的.

更多细节

>我们使用API​​来访问AWS上托管的视频
>我们还使用托管在其他网站上的视频进行了测试
较小的视频(我们打算使用的视频是20 MB

如果有人能提供一些指导,我们真的很感激!谢谢!

编辑

这是我们正在使用的代码结构,直接来自PHP库:

function insertAttachment($service,$ITemId,$contentTyPE,$attachment) {

  try {

    $params = array(

        'data' => $attachment,'mimeType' => $contentType,'uploadType' => 'media');

    return $service->timeline_attachments->insert($itemId,$params);

  } catch (Exception $e) {

    PRint 'An error ocurred: ' . $e->getMessage();

    return null;

  }

}

这是尝试将视频流式传输的最新版本:

$bundle_view = $app->view();
       $bundle_view->appendData(array('total' => count($response['seArch']),'video'=>$response['search'][0]));
       $bundle_htML = $app->view()->fetch('bundle_home.twig');
       $new_timeline_item = new Google_Timelineitem();


       $new_timeline_item->setHtml($bundle_html);
       //$new_timeline_item->setBundleId($response['search'][0]['id']);
       $new_timeline_item->isBundleCover = 'true';
       $notification = new Google_NotificationConfig();
       $notification->setLevel("DEFAULT");
       $new_timeline_item->setNotification($notification);

       $post_result = insert_timeline_item($mirror_service,$new_timeline_item,null,null);

       error_LOG(print_r($post_result->getId(),true));

       $new_timeline_item->setHtmlPages("<article><section> <video src='http://www.w3schools.COM/html/movie.mp4' controls> </section></article>");

       /**
       foreach ($response['search'] as $video) {
           $item = $video['videos'][0];
           $v_item = new Google_MediaFileUpload('video/vnd.google-glass.stream-url',$item,true);

           $params = array(
               'data' => $v_item,'mimeType' => 'video/*','uploadType' => 'resumable');

           $mirror_service->timeline_attachments->insert($post_result->getId(),$params);
       }
       **/
       insert_timeline_item($mirror_service,null);

在Gist中可能更容易阅读:https://gist.github.com/kgardnr/1f2ce243f91cedaf9c92

解决方法

它似乎是在setHTMLPages中使用视频元素,它是一个被阻止的HTML元素.这是问题的根本原因吗?

脚本宝典总结

以上是脚本宝典为你收集整理的php – 无法在Google Glass上播放视频(附件选项或捆绑选项)全部内容,希望文章能够帮你解决php – 无法在Google Glass上播放视频(附件选项或捆绑选项)所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。