【问题标题】:play hls/rtmp on android在安卓上播放 hls/rtmp
【发布时间】:2015-04-22 21:52:01
【问题描述】:

我有一个 wowza 服务器,我在其中播放使用 jwplayer 播放的直播。 不过,一切都可以在 android 和其他系统上正常运行。 (适用于 android 4.4 和 jwplayer (!) 中的 rtmp 和 hls)。 流被发送到我的 wowza 服务器,并在 linux pc 上运行 avconv,这工作正常。

但是,当我尝试使用 avconv(如上例中的相同命令,但目的地不同)直接从 linux pc 将流发送到本地服务器时,它在我尝试过的所有基于浏览器的播放器的 android 上都失败了,包括jwplayer。这些流可以在其他系统上使用 jwplayer,例如 linux、chromebook。我从 Android 中的 jwplayer 得到的错误是 'No playable sources found'

我已尝试使用 crtmp rtmp,以及用于 rtmp 和 hls 的 nginx rtp 模块。总是以相同的结果,android失败。为什么这些流在使用 wowza 时在 android 上运行时会失败?

我当前的设置是带有 rtmp 模块的 nginx,这里是 nginx.conf:

worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;



events {
    worker_connections  1024;
}


http {

    server {

        listen      8080;


 location / {
            add_header Access-Control-Allow-Origin *;
            root   html;
            index  index.html index.htm;
        }


        location /hls {
            # Serve HLS fragments
            types {
            add_header Access-Control-Allow-Origin *;

                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            root /tmp;
            add_header Cache-Control no-cache;
            add_header Access-Control-Allow-Origin *;

        }

        location /dash {
            # Serve DASH fragments
            root /tmp;
            add_header Cache-Control no-cache;
        }
    }
}


rtmp {

    server {

        listen 1935;
        chunk_size 4000;

        application hls {
            live on;
            hls on;
            hls_path /tmp/hls;
        }

        # MPEG-DASH is similar to HLS

        application dash {
            live on;
            dash on;
            dash_path /tmp/dash;
        }
    }
}

这里是 avconv 命令:

avconv -g 40 -threads 4  -f video4linux2  -video_size $SIZE   -r 15 -i /dev/video0  -itsoffset -3.35 -i audio0.fifo -re -vcodec libx264 -r 15  -preset veryfast -tune zerolatency  -aq 0  -q 3 -vbr 3 -maxrate 3M   -threads 4 -f flv rtmp://192.168.0.6/hls/mycam

当通过 wowza 而不是 localhost (!92.168.0.6) 使用上面的命令时,它可以在带有 jwplayer 的 android 上运行。

所以只有通过本地服务器的android没有成功,只有在使用wowza时......奇怪,有什么想法吗?我的 android 是运行 android 4.4 的平板电脑,但我也尝试了其他一些 android 版本。我当然愿意使用其他播放器进行故障排除,但最终结果必须是一些基于浏览器的播放器。

【问题讨论】:

  • 您是否尝试过使用 mx-player 进行调试?你的 avconv 命令是什么样子的?
  • 刚刚将 avplayer 命令添加到我原来的问题中,感谢您指出这一点。明天将研究 mx-player 并进行更新,感谢您的提示!
  • 您的 JW 播放器设置代码是什么样的?
  • 发布avconv命令的控制台日志。现在的方式会导致至少一个错误,因为您在需要输入时将-re 添加到输出(应该放在-i 之前)

标签: android jwplayer rtmp avconv http-live-streaming


【解决方案1】:

您还可以使用来自 Wowza 的 MPEG-DASH 输出,并在 Android 上使用 bitdash HTML5 MPEG-DASH 播放器在 HTML5 中播放:http://www.dash-player.com

【讨论】:

  • 这没有回答原始问题。它会更适合作为评论。
猜你喜欢
  • 2013-10-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-09
  • 1970-01-01
  • 2016-02-12
相关资源
最近更新 更多