如何使用的VideoPlayer时进行身份验证? [英] How to authenticate when using VideoPlayer?

查看:326
本文介绍了如何使用的VideoPlayer时进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了以下解决方案玻璃播放视频

 意向书I =新意图();
i.setAction(com.google.glass.action.VIDEOPLAYER);
i.putExtra(VIDEO_URL,......);
startActivity(ⅰ);

但我击中了401错误。

要验证我需要在我的头键/值对。

我如何去这样做,与意图?

  14 10-16:58:55.229 126-10199 /? I / ChromiumHTTPDataSourceSupport:服务器,HTTP状态401回应
10-16 14:58:55.229 126-10470 /? I / AwesomePlayer:mConnectingDataSource-> connect()的返回-1004
10-16 14:58:55.229 10175-10216 /? E / MediaPlayer的:错误(1,-1004)
10-16 14:58:55.237 10175-10197 /? W /的VideoPlayer:无法开始播放。
    java.io.IOException异常:prepare失败:状态=为0x1
            在android.media.MediaPlayer。prepare(本机方法)
            在com.google.glass.videoplayer.VideoPlayer $ 4.serialDoInBackground(的SourceFile:577)
            在com.google.glass.videoplayer.VideoPlayer $ 4.serialDoInBackground(的SourceFile:463)
            在com.google.glass.async.SerialAsyncTask.doInBackground(的SourceFile:59)
            在android.os.AsyncTask $ 2.call(AsyncTask.java:302)
            在java.util.concurrent.FutureTask.run(FutureTask.java:237)
            在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            在java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:587)
            在com.google.glass.async.PriorityThreadFactory $ 1.run(的SourceFile:39)
            在java.lang.Thread.run(Thread.java:841)


解决方案

目前(仅用于测试),我做了记号的查询参数,并通过认证。

I am implementing the following solution Play a video in Glass

Intent i = new Intent();
i.setAction("com.google.glass.action.VIDEOPLAYER");
i.putExtra("video_url", "..."); 
startActivity(i); 

But I am getting hit with a 401 error.

To authenticate I need to include my key/value pair in header.

How do I go about doing that, with intents?

10-16 14:58:55.229    126-10199/? I/ChromiumHTTPDataSourceSupport﹕ Server responded with http status 401
10-16 14:58:55.229    126-10470/? I/AwesomePlayer﹕ mConnectingDataSource->connect() returned -1004
10-16 14:58:55.229  10175-10216/? E/MediaPlayer﹕ error (1, -1004)
10-16 14:58:55.237  10175-10197/? W/VideoPlayer﹕ Failed to start playback.
    java.io.IOException: Prepare failed.: status=0x1
            at android.media.MediaPlayer.prepare(Native Method)
            at com.google.glass.videoplayer.VideoPlayer$4.serialDoInBackground(SourceFile:577)
            at com.google.glass.videoplayer.VideoPlayer$4.serialDoInBackground(SourceFile:463)
            at com.google.glass.async.SerialAsyncTask.doInBackground(SourceFile:59)
            at android.os.AsyncTask$2.call(AsyncTask.java:302)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at com.google.glass.async.PriorityThreadFactory$1.run(SourceFile:39)
            at java.lang.Thread.run(Thread.java:841)

解决方案

Currently (only for testing) I made the token a query parameter, and authenticated through that.

这篇关于如何使用的VideoPlayer时进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆