【问题标题】:How to authenticate when using VideoPlayer?使用 VideoPlayer 时如何进行身份验证?
【发布时间】:2014-10-16 19:24:31
【问题描述】:

我正在实施以下解决方案Play a video in Glass

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

但是我遇到了 401 错误。

要进行身份验证,我需要在标题中包含我的键/值对。

我该如何做呢?

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)

【问题讨论】:

    标签: android android-intent google-glass google-gdk


    【解决方案1】:

    com.google.glass.action.VIDEOPLAYER Intent 是一个未记录的 Intent,可能会在没有任何通知的情况下更改。它没有官方支持,因此没有身份验证。

    如果您需要视频播放功能,我强烈建议您关注此feature request。

    【讨论】:

    • 您提供的链接用于播放本地视频。我希望从 url 播放视频,并进行身份验证。有什么办法吗?
    • @Alain 这个意图将来会被记录下来吗?
    【解决方案2】:

    如果您在设置数据源之前调用媒体播放器的准备方法或 setdatasource 失败,则您好媒体播放器的准备方法失败 换个网址试试

    【讨论】:

      【解决方案3】:

      目前(仅用于测试)我将令牌作为查询参数,并通过它进行身份验证。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-11-24
        • 1970-01-01
        • 1970-01-01
        • 2017-11-10
        • 2011-07-15
        • 2020-05-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多