Google Mirror API Video
Asked Answered
B

2

6

What is the roadmap for video on the google glass mirror API? Will the API allow for streaming video to or from the device as shown in the glass demo video http://www.youtube.com/watch?v=v1uyQZNg2vE ?

Boole answered 17/4, 2013 at 1:24 Comment(0)
A
8

There is no published roadmap for the Mirror API. Part of the motivation for our developer preview is to figure that out.

First, just to clarify, the streaming shown in that video is a Google+ Hangout. This is a feature that's built into Glass.

Update: Glass now supports video streaming. You can find the full docs here.

To add a video stream make a multipart POST with the URL to the video as one of the parts, like this:

POST /upload/mirror/v1/timeline HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer {auth token}
Content-Type: multipart/related; boundary="mymultipartboundary"
Content-Length: {length}

--mymultipartboundary
Content-Type: application/json; charset=UTF-8

{ "text": "Skateboarding kittens" }
--mymultipartboundary
Content-Type: video/vnd.google-glass.stream-url

http://example.com/path/to/kittens.mp4
--mymultipartboundary--
Angrist answered 17/4, 2013 at 1:43 Comment(3)
Great will do on the issue tracker. I think adding the ability to push cards during a google hangout would be great.Boole
When attempting to user video/vnd.google-glass.stream-url the content never plays. The first frame is displayed, and the loading animation runs forever. Any chance we can see some code samples added to the docs of this being implemented?Namely
@Namely - I need more details to help you troubleshoot. Would you mind creating a new question and including your code and JSON payloads?Angrist
C
1

Youtube video streaming is possible. I have done it in C#.net using "YoutubeExtractor" namespace. Resolve the video(.mp4) url from the you tube video and stream it. Here is the code. It worked fine for me. when copying the url get the you tube link that available after you click share

private static String youtubevideoStream(MainController controller)
    {

        string link = "http://youtu.be/9uYKISlL7Vg";
        IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
        VideoInfo video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
        String vLink = video.DownloadUrl;


        TimelineItem videocard= new TimelineItem()
        {

            Text = "Menu Card",
            BundleId = "666",
            Notification = new NotificationConfig() { Level = "DEFAULT" },
            MenuItems = new List<MenuItem>()
                                     {
                                         new MenuItem() {Action = "DELETE"},
                                     }

        };

        String mediaLink = vLink;

        if (!String.IsNullOrEmpty(mediaLink))
        {
            Stream stream = null;
            if (mediaLink.StartsWith("/"))
            {
                stream = new StreamReader(controller.Server.MapPath(mediaLink)).BaseStream;
            }
            else
            {
                HttpWebRequest request = WebRequest.Create(mediaLink) as HttpWebRequest;

                request.UseDefaultCredentials = false;


                HttpWebResponse response = request.GetResponse() as HttpWebResponse;

                byte[] b = null;
                using (Stream streamFromWeb = response.GetResponseStream())
                using (MemoryStream ms = new MemoryStream())
                {
                    int count = 0;
                    do
                    {
                        byte[] buf = new byte[1024];
                        count = streamFromWeb.Read(buf, 0, 1024);
                        ms.Write(buf, 0, count);
                    } while (streamFromWeb.CanRead && count > 0);
                    b = ms.ToArray();

                    stream = new MemoryStream(b);
                }
            }
            controller.Service.Timeline.Insert(videocard, stream, "video/mp4").Upload();
        }
        else
        {
            controller.Service.Timeline.Insert(videocard).Fetch();
        }
Coughlin answered 16/10, 2013 at 3:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.