Lộ trình cho video trên API gương kính google là gì? API có cho phép phát trực tuyến video đến hoặc từ thiết bị như được hiển thị trong video giới thiệu kính http://www.youtube.com/watch?v=v1uyQZNg2vE không?Google Mirror API Video
Trả lời
Không có lộ trình được xuất bản cho API gương. Một phần của động lực cho bản xem trước nhà phát triển của chúng tôi là tìm ra điều đó.
Trước tiên, chỉ cần làm rõ, luồng được hiển thị trong video đó là Hangout trên Google+. Đây là một tính năng được tích hợp vào Glass.
Cập nhật: Kính hiện hỗ trợ phát trực tuyến video. Bạn có thể tìm thấy toàn bộ tài liệu here.
Để thêm một dòng video làm một POST nhiều phần dữ liệu với URL tới video là một trong các bộ phận, như thế này:
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--
Youtube video là có thể. Tôi đã thực hiện nó trong C# .net sử dụng không gian tên "YoutubeExtractor". Giải quyết url video (.mp4) từ video ống của bạn và phát trực tuyến. Đây là mã. Nó làm việc tốt cho tôi. khi sao chép url, bạn sẽ nhận được liên kết ống bạn có sẵn sau khi bạn nhấp vào chia sẻ
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();
}
Tuyệt vời sẽ thực hiện theo dõi vấn đề. Tôi nghĩ rằng việc thêm khả năng đẩy thẻ trong một hangout trên google sẽ rất tuyệt. – djscoutmaster
Khi cố gắng sử dụng video/vnd.google-glass.stream-url, nội dung không bao giờ phát. Khung đầu tiên được hiển thị và hoạt ảnh tải chạy vĩnh viễn. Bất kỳ cơ hội nào chúng ta có thể thấy một số mẫu mã được thêm vào tài liệu về việc này đang được triển khai? – PrplRugby
@PrplRugby - Tôi cần thêm chi tiết để giúp bạn khắc phục sự cố. Bạn có thể tạo ra một câu hỏi mới và bao gồm cả mã của bạn và tải trọng JSON không? – mimming