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

标签 php google-mirror-api 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, $new_timeline_item, null, null);

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

最佳答案

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

关于php - 无法在 Google Glass 上播放视频(附件选项或捆绑选项),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17882492/

相关文章:

php - 如何将数组放入MySQL?

google-glass - 我可以在 Google Glass 应用程序中通过 Mirror API 使用自己的语音命令吗?

android - 更新 Glass 时间线卡的更好解决方案

java - 凭据在 glass-java-starter 项目的通知流中为空

google-glass - Google Glass Mirror API 中的分页与捆绑

android - 找不到 Google Glass ADB 设备。未安装 OMAP4430 驱动程序(找不到!)

php - 如何删除 ManyToMany 关系中的部分数据

PHP SCRIPT - 执行时不更新数据库

javascript - 如何以 javascript 方式创建 php getter 和 setter

android - 在 Google Glass 上分享 Immersion 的内容?