Unable to transfer video to Google Glass (attachment option or connect option)

My hackathon team has been working the last 12 hours to use the Google Glass and Mirror APIs to play videos, in particular using the PHP library.

We tried to connect the video to the timeline element, and we tried to use the bundle option, but none of them will transmit the video.

I have no error message, and the code, as far as we can see, is correct, based on Google documentation.

Additional Information:

  • We use the API to access AWS hosted videos
  • We also tested videos hosted on other sites, as well as smaller videos (the one we are going to use is 20 + MB

If someone can offer some guidance, we will be very grateful! Thanks!

EDIT

This is the code structure we use directly from the PHP library:

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; } } 

And hereโ€™s the last iteration of the attempt to stream the video:

  $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); 

Easier to read in Gist: https://gist.github.com/kgardnr/1f2ce243f91cedaf9c92

+4
source share
2 answers

It appears that setHTMLPages uses a video element, which is a blocked HTML element. Is this the main cause of the problem?

+1
source

Streaming video currently cannot be attached via HTML, and I donโ€™t think you can do something on top of it. In my experience, it is also not very well (or generally) included in libraries (at least not a .NET one ... I assume that PHP is the same).

I needed to create a web request myself, as described here: https://developers.google.com/glass/timeline in the streaming video section

0
source

Source: https://habr.com/ru/post/1493672/


All Articles