php – 无法在Google Glass上播放视频(附件选项或捆绑选项)
发布时间:2020-12-13 22:49:29 所属栏目:PHP教程 来源:网络整理
导读:我的黑客马拉松团队在过去12小时内一直在使用Google Glass和Mirror API来播放视频,特别是使用 PHP库. 我们已尝试将视频附加到时间轴项目,我们已尝试使用捆绑选项,但两者都不会流式传输视频. 我没有要显示的错误消息,根据Google文档,我们可以看到的代码是正确
我的黑客马拉松团队在过去12小时内一直在使用Google Glass和Mirror API来播放视频,特别是使用
PHP库.
我们已尝试将视频附加到时间轴项目,我们已尝试使用捆绑选项,但两者都不会流式传输视频. 我没有要显示的错误消息,根据Google文档,我们可以看到的代码是正确的. 更多细节: >我们使用API??来访问AWS上托管的视频 如果有人能提供一些指导,我们真的很感激!谢谢! 编辑 这是我们正在使用的代码结构,直接来自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元素.这是问题的根本原因吗?
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |