HLS在Android 3.0和寻求(HTTP实时流) [英] HLS (http live streaming) on Android 3.0 and seeking

查看:138
本文介绍了HLS在Android 3.0和寻求(HTTP实时流)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个供应商,为我们提供了M3U8文件HLS流(原本打算用于iOS应用程序)。

We have a provider that gives us m3u8 files for HLS streams (originally intended for use in an iOS app).

安卓3.0+支持HTTP实时流媒体(http://developer.android.com/guide/appendix/media-formats.html) - 我们其实可以发挥使用标准VideoView这些M3U8文件在Android 3.0+。

Android 3.0+ supports http live streaming (http://developer.android.com/guide/appendix/media-formats.html) - and we can in fact play these m3u8 files using the standard VideoView on Android 3.0+.

编辑:Android的似乎将此视为实时的视频源,并且禁止在寻求或计算的视频持续时间的能力。 (其中,为的iOS使你可以没有问题的流中求)

Android seems to treat this as "real-time" video feed, and disables the ability to seek or calculate a video duration. (Where-as iOS let's you seek within the stream without issue)

有没有办法强迫的Andr​​oid 3.0+这些文件中寻求?

Is there any way to force android 3.0+ to seek within these files?

下面是一个简单的活动为别人来测试:

Here is a sample activity for others to test with:

import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class SandboxActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        VideoView vw = (VideoView) findViewById(R.id.videoView);
      vw.setVideoPath("http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8"); 
        vw.setMediaController(new MediaController(this));
        vw.requestFocus();
        vw.start();
    }
}

和样品布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center" android:id="@+id/root">

    <VideoView
        android:id="@+id/videoView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent" />
</RelativeLayout>

这是使用来自苹果样本HLS链接。

This is using a sample HLS link from Apple.

推荐答案

看看这个(你提到过)的页面

Look at this (which you referred too) page

它说:

      
  • 在协议版本3(的Andr​​oid 4.0及以上)
  •   
  • 在协议版本2(安卓3.X)
  •   

在这里你可以查看草案的合肥光源。你可以选择一个版本,在页面的顶部。

And here you can check draft's for HLS. You can choose a version at the top of the page.

首先参考寻求出现在草案3(比较起草2的Andr​​oid 3.X)

First reference to seeking appeared in draft 3 (comparing to draft 2 Android 3.x)

价值      日期和时间提供了时间表的信息映射      媒体到一个适当的挂钟时间,其可以用作      为基础的寻找

The value of the date and time provides an informative mapping of the timeline of the media to an appropriate wall-clock time, which may be used as a basis for seeking

只是为了确保。我没有通过整个草案内容。但是,我的猜测是,Android的实施的Andr​​oid 3.0很早就草案,他们可能已经部分地实现它,这是够玩,但它不足以谋。

Just to make sure. I didn't read through whole draft. But, my guess would be that Android implemented quite early draft in Android 3.0 and they may have implemented it partially, which is enough to play, but it's not enough to seek.

我不认为你有一个简单的办法对于这一点,除了在第三方HLS客户端盐渍(所建议的用vipw)

I don't think that you have an easy fix for this, except brining in 3rd party HLS client (as suggested by vipw)

这篇关于HLS在Android 3.0和寻求(HTTP实时流)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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