简体   繁体   English

Android 和 Vitamio:抱歉,此视频无法播放

[英]Android and Vitamio: sorry, this video cannot be played

I am developing a small TV app which uses a number of TV streams in m3u8 format.我正在开发一个使用 m3u8 格式的多个电视流的小型电视应用程序。 If I use native VideoView, all streams works fine.如果我使用本机 VideoView,则所有流都可以正常工作。 But I want to use Vitamio for better supporting different protocols and video codecs.但我想使用 Vitamio 来更好地支持不同的协议和视频编解码器。 I added Vitamio to my project instead of native VideoView.我将 Vitamio 添加到我的项目中,而不是本机 VideoView。 It very easy, but I have an error for all streams: " Cannot play video. Sorry, this video cannot be played ."这很容易,但我对所有流都有错误:“无法播放视频。抱歉,无法播放此视频。” In the logcat: " E/Vitamio[Player]﹕ Error (1, -1094995529) " I read many similar articles how to add Vitamio and can't find what I am doing wrong.在 logcat 中:“ E/Vitamio[Player]: Error (1, -1094995529) ”我阅读了许多类似的文章如何添加 Vitamio,但找不到我做错了什么。

In the manifest internet access is required, device has access to the Internet.在清单中需要互联网访问,设备可以访问互联网。

also:还:

    <activity android:name="io.vov.vitamio.activity.InitActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden"
android:launchMode="singleTop"
android:theme="@android:style/Theme.NoTitleBar"
android:windowSoftInputMode="stateAlwaysHidden"/>

in the module.app在 module.app 中

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'me.neavo:vitamio:4.2.2'
}

This is a code I use for testing:这是我用于测试的代码:

import io.vov.vitamio.LibsChecker;
import io.vov.vitamio.MediaPlayer;
import io.vov.vitamio.widget.MediaController;
import io.vov.vitamio.widget.VideoView;

public class MainActivity extends AppCompatActivity {

    VideoView vidView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        vidView = (VideoView)findViewById(R.id.myVideo);
        getSupportActionBar().hide();
        if (!LibsChecker.checkVitamioLibs(this))
            return;

        vidView.setMediaController(new MediaController(this));
        vidView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                mediaPlayer.setPlaybackSpeed(1.0f);
            }
        });
        vidView.setVideoPath("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8");
        vidView.requestFocus();
    }

Error codes from ffmpeg (error.h from avutil) : http://ffmpeg.org/doxygen/trunk/error_8h_source.html来自 ffmpeg 的错误代码(来自 avutil 的 error.h): http ://ffmpeg.org/doxygen/trunk/error_8h_source.html

It turns out the value you specified is :原来你指定的值是:

#define AVERROR_INVALIDDATA        FFERRTAG( 'I','N','D','A')

The -1094995529 becomes -0x41444E49 and when you look at those letters, in ACSII, 0x41 = 'A', 0x44 = 'D', 0x4E = 'N, and 0x49 = 'I'. -1094995529 变为 -0x41444E49,当您查看这些字母时,在 ACSII 中,0x41 = 'A'、0x44 = 'D'、0x4E = 'N 和 0x49 = 'I'。 Due to the macro/etc things are reversed, so ADNI becomes INDA, which you can see from the #define snippet, is the AVERROR_INVALIDDATA defined FFERRTAG( 'I','N','D','A').由于宏/等事物被颠倒了,所以ADNI变成了INDA,你可以从#define片段中看到,是AVERROR_INVALIDDATA定义的FFERRTAG('I','N','D','A')。

The rest of the error codes are in that file and I've pasted them below here :其余的错误代码在该文件中,我已将它们粘贴在下面:

#define AVERROR_BSF_NOT_FOUND      FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
#define AVERROR_BUG                FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
#define AVERROR_BUFFER_TOO_SMALL   FFERRTAG( 'B','U','F','S') ///< Buffer too small
#define AVERROR_DECODER_NOT_FOUND  FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
#define AVERROR_DEMUXER_NOT_FOUND  FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
#define AVERROR_ENCODER_NOT_FOUND  FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
#define AVERROR_EOF                FFERRTAG( 'E','O','F',' ') ///< End of file
#define AVERROR_EXIT               FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
#define AVERROR_EXTERNAL           FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
#define AVERROR_FILTER_NOT_FOUND   FFERRTAG(0xF8,'F','I','L') ///< Filter not found
#define AVERROR_INVALIDDATA        FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
#define AVERROR_MUXER_NOT_FOUND    FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
#define AVERROR_OPTION_NOT_FOUND   FFERRTAG(0xF8,'O','P','T') ///< Option not found
#define AVERROR_PATCHWELCOME       FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
#define AVERROR_STREAM_NOT_FOUND   FFERRTAG(0xF8,'S','T','R') ///< Stream not found
#define AVERROR_BUG2               FFERRTAG( 'B','U','G',' ')
#define AVERROR_UNKNOWN            FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
#define AVERROR_EXPERIMENTAL       (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
#define AVERROR_INPUT_CHANGED      (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
#define AVERROR_OUTPUT_CHANGED     (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
#define AVERROR_HTTP_BAD_REQUEST   FFERRTAG(0xF8,'4','0','0')
#define AVERROR_HTTP_UNAUTHORIZED  FFERRTAG(0xF8,'4','0','1')
#define AVERROR_HTTP_FORBIDDEN     FFERRTAG(0xF8,'4','0','3')
#define AVERROR_HTTP_NOT_FOUND     FFERRTAG(0xF8,'4','0','4')
#define AVERROR_HTTP_OTHER_4XX     FFERRTAG(0xF8,'4','X','X')
#define AVERROR_HTTP_SERVER_ERROR  FFERRTAG(0xF8,'5','X','X')

You video path specifies a file which needs additional files.您的视频路径指定了需要附加文件的文件。 That is, it internally references gear4\\prog_index.m3u8, so you may have to load that as well?也就是说,它在内部引用了 gear4\\prog_index.m3u8,所以您可能也必须加载它?

Because vitamio is returning an ffmpeg error code, I suspect that it depends on ffmpeg in some way that using VideoView handles, but using it directly does not.因为 vitamio 返回一个 ffmpeg 错误代码,我怀疑它在某种程度上依赖于 ffmpeg,使用 VideoView 句柄,但直接使用它不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM