google glass mirror API上的视频路线图是什么?该应用编程接口是否允许像玻璃演示视频http://www.youtube.com/watch?v=v1uyQZNg2vE中所示的那样,向设备发送或从设备发送视频流?
发布于 2013-04-17 09:43:07
没有发布Mirror API的路线图。我们开发人员预览版的部分动机就是想弄清楚这一点。
首先,为了澄清,视频中显示的流媒体是一个Google+ Hangout。这是谷歌眼镜内置的一个功能。
更新:谷歌眼镜现在支持视频流。您可以找到完整的文档here。
要添加视频流,请使用视频的URL作为其中一个部分进行多部分发布,如下所示:
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--发布于 2013-10-16 11:54:45
Youtube视频流媒体是可能的。我已经使用"YoutubeExtractor“命名空间在C#.net中做到了这一点。从you tube视频中解析视频(.mp4) url并将其流式传输。下面是代码。它对我来说工作得很好。复制url时,请单击共享后获得可用的you tube链接
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();
}https://stackoverflow.com/questions/16049889
复制相似问题