- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我写了一个简单的代码,用于在 Android 应用程序上播放视频。我使用了 Vitamio Library,按照所有必要的步骤集成到项目中。视频不播放,应用程序在加载时崩溃。
package com.test.bufferapp;
import io.vov.vitamio.LibsChecker;
import io.vov.vitamio.MediaPlayer;
import io.vov.vitamio.widget.MediaController;
import io.vov.vitamio.widget.VideoView;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
public class MainActivity extends Activity {
private String path = "rtsp://184.72.239.149/vod/mp4:sample.mp4";
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
if (!LibsChecker.checkVitamioLibs(this))
return;
setContentView(R.layout.activity_main);
mVideoView = (VideoView) findViewById(R.id.video_view);
if (path == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(this.getApplicationContext(), "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", Toast.LENGTH_LONG).show();
return;
} else {
mVideoView.setVideoPath("rtsp://184.72.239.149/vod/mp4:sample.mp4");
// MediaController mc = new MediaController(getApplicationContext());
// mVideoView.setMediaController(mc);
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
// optional need Vitamio 4.0
mediaPlayer.setPlaybackSpeed(1.0f);
}
});
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
下面是Logcat
09-05 04:40:42.650: D/Vitamio[Player](1072): CPU implementer:0x41
09-05 04:40:42.650: D/Vitamio[Player](1072): Serial:0000000000000000
09-05 04:40:42.660: D/Vitamio[Player](1072): CPU architecture:7
09-05 04:40:42.660: D/Vitamio[Player](1072): Hardware:Goldfish
09-05 04:40:42.660: D/Vitamio[Player](1072): CPU revision:0
09-05 04:40:42.660: D/Vitamio[Player](1072): CPU variant:0x0
09-05 04:40:42.660: D/Vitamio[Player](1072): CPU part:0xc08
09-05 04:40:42.660: D/Vitamio[Player](1072): Revision:0000
09-05 04:40:42.660: D/Vitamio[Player](1072): BogoMIPS:368.64
09-05 04:40:42.660: D/Vitamio[Player](1072): Features:swp half thumb fastmult vfp edsp neon vfpv3 tls
09-05 04:40:42.660: D/Vitamio[Player](1072): Processor:ARMv7 Processor rev 0 (v7l)
09-05 04:40:42.660: D/Vitamio[Player](1072): CPU architecture: 7
09-05 04:40:42.660: D/Vitamio[Player](1072): GET CPU FATURE: V5TE V6 VFP V7A VFPV3 NEON
09-05 04:40:42.750: D/dalvikvm(1072): Trying to load lib /data/app-lib/com.test.bufferapp-2/libvinit.so 0xb3dcea40
09-05 04:40:42.750: D/dalvikvm(1072): Added shared lib /data/app-lib/com.test.bufferapp-2/libvinit.so 0xb3dcea40
09-05 04:40:42.840: I/Vitamio[Player](1072): isNativeLibsInited, APP VERSION: 1, Vitamio Library version: 1
09-05 04:40:43.650: I/Vitamio[Player](1072): isNativeLibsInited, APP VERSION: 1, Vitamio Library version: 1
09-05 04:40:43.710: I/Vitamio[Player](1072): LIB ROOT: /data/data/com.test.bufferapp/libs/
09-05 04:40:43.710: D/dalvikvm(1072): Trying to load lib /data/data/com.test.bufferapp/libs/libstlport_shared.so 0xb3dcea40
09-05 04:40:43.740: D/dalvikvm(1072): Added shared lib /data/data/com.test.bufferapp/libs/libstlport_shared.so 0xb3dcea40
09-05 04:40:43.740: D/dalvikvm(1072): No JNI_OnLoad found in /data/data/com.test.bufferapp/libs/libstlport_shared.so 0xb3dcea40, skipping init
09-05 04:40:43.740: D/dalvikvm(1072): Trying to load lib /data/data/com.test.bufferapp/libs/libvplayer.so 0xb3dcea40
09-05 04:40:43.760: D/dalvikvm(1072): Added shared lib /data/data/com.test.bufferapp/libs/libvplayer.so 0xb3dcea40
09-05 04:40:43.760: I/Vitamio[4.2.1][Player](1072): Copyright (c) YIXIA (http://yixia.com).
09-05 04:40:43.760: I/Vitamio[4.2.1][Player](1072): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
09-05 04:40:43.760: I/Vitamio[4.2.1][Player](1072): LOAD FFMPEG START: /data/data/com.test.bufferapp/libs/libffmpeg.so
09-05 04:40:43.760: W/linker(1072): libffmpeg.so has text relocations. This is wasting memory and is a security risk. Please fix.
09-05 04:40:43.800: I/Vitamio[4.2.1][Player](1072): LOAD FFMPEG END: /data/data/com.test.bufferapp/libs/libffmpeg.so
09-05 04:40:43.800: I/Vitamio[4.2.1][Player](1072): LOAD VVO START: /data/data/com.test.bufferapp/libs/libvvo.9.so
09-05 04:40:43.800: E/Vitamio[4.2.1][Player](1072): FIND_NAME_SYM vvo, render_yuv
09-05 04:40:43.800: I/Vitamio[4.2.1][Player](1072): LOAD VVO END: /data/data/com.test.bufferapp/libs/libvvo.9.so
09-05 04:40:43.800: I/Vitamio[4.2.1][Player](1072): LOAD VAO START: /data/data/com.test.bufferapp/libs/libvao.0.so
09-05 04:40:43.830: I/Vitamio[4.2.1][Player](1072): LOAD VAO END: /data/data/com.test.bufferapp/libs/libvao.0.so
09-05 04:40:43.830: I/Vitamio[4.2.1][Player](1072): VPLAYER INIT BEGIN
09-05 04:40:43.830: I/Vitamio[4.2.1][Player](1072): Application package name: com.test.bufferapp
09-05 04:40:43.910: I/Vitamio[4.2.1][Player](1072): VPLAYER INIT END
09-05 04:40:43.910: I/Vitamio[4.2.1][Player](1072): Copyright (c) YIXIA (http://yixia.com).
09-05 04:40:43.910: I/Vitamio[4.2.1][Player](1072): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): Application package name: com.test.bufferapp
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): Copyright (c) YIXIA (http://yixia.com).
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): Application package name: com.test.bufferapp
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): PREPARE SIG: 0
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): THREAD PREPARE START
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): THREAD PREPARE ATTACHED
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): Copyright (c) YIXIA (http://yixia.com).
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
09-05 04:40:43.920: I/Vitamio[4.2.1][Player](1072): OPEN FILE rtsp://184.72.239.149/vod/mp4:sample.mp4
09-05 04:40:44.000: I/Choreographer(1072): Skipped 58 frames! The application may be doing too much work on its main thread.
09-05 04:40:44.150: D/gralloc_goldfish(1072): Emulator without GPU emulation detected.
09-05 04:41:02.646: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] Missing reference picture, default is 0
09-05 04:41:02.646: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] decode_slice_header error
09-05 04:41:02.676: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] Missing reference picture, default is 65538
09-05 04:41:02.696: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] Missing reference picture, default is 65540
09-05 04:41:03.836: I/Vitamio[4.2.1][Player](1072): META AUDIO: 0. und, META SUBTITLE:
09-05 04:41:03.836: I/Vitamio[4.2.1][Player](1072): OOPS: ONLY 1
09-05 04:41:03.886: I/Vitamio[4.2.1][Player](1072): OPEN STREAM AUDIO BEGIN
09-05 04:41:03.886: I/Vitamio[4.2.1][Player](1072): Copyright (c) YIXIA (http://yixia.com).
09-05 04:41:03.886: I/Vitamio[4.2.1][Player](1072): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
09-05 04:41:03.886: I/Vitamio[4.2.1][Player](1072): Application package name: com.test.bufferapp
09-05 04:41:03.886: I/Vitamio[4.2.1][Player](1072): 2, 48000, 0
09-05 04:41:03.906: E/android.media.AudioTrack(1072): getMinBufferSize(): error querying hardware
09-05 04:41:03.926: E/Vitamio[Player](1072): audioTrackInit
09-05 04:41:03.926: E/Vitamio[Player](1072): java.lang.IllegalArgumentException: Invalid audio buffer size.
09-05 04:41:03.926: E/Vitamio[Player](1072): at android.media.AudioTrack.audioBuffSizeCheck(AudioTrack.java:477)
09-05 04:41:03.926: E/Vitamio[Player](1072): at android.media.AudioTrack.<init>(AudioTrack.java:317)
09-05 04:41:03.926: E/Vitamio[Player](1072): at android.media.AudioTrack.<init>(AudioTrack.java:265)
09-05 04:41:03.926: E/Vitamio[Player](1072): at io.vov.vitamio.MediaPlayer.audioTrackInit(MediaPlayer.java:1211)
09-05 04:41:03.926: E/Vitamio[Player](1072): at dalvik.system.NativeStart.run(Native Method)
09-05 04:41:03.926: I/Vitamio[4.2.1][Player](1072): CLOSE STREAM AUDIO BEGIN
09-05 04:41:03.926: I/Vitamio[4.2.1][Player](1072): CLOSE STREAM AUDIO END
09-05 04:41:03.936: I/Vitamio[4.2.1][Player](1072): OPEN STREAM AUDIO END
09-05 04:41:03.936: I/Vitamio[4.2.1][Player](1072): Copyright (c) YIXIA (http://yixia.com).
09-05 04:41:03.936: I/Vitamio[4.2.1][Player](1072): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
09-05 04:41:03.936: I/Vitamio[4.2.1][Player](1072): Application package name: com.test.bufferapp
09-05 04:41:03.936: I/Vitamio[4.2.1][Player](1072): OOPS: ONLY 1
09-05 04:41:03.936: I/Vitamio[4.2.1][Player](1072): OPEN STREAM VIDEO BEGIN
09-05 04:41:03.946: I/Vitamio[4.2.1][Player](1072): OPEN STREAM VIDEO END
09-05 04:41:03.966: I/Vitamio[4.2.1][Player](1072): THREAD PREPARE DETTACHED, ret = 0
09-05 04:41:03.966: I/Vitamio[4.2.1][Player](1072): THREAD PREPARE END
09-05 04:41:04.016: I/Vitamio[4.2.1][Player](1072): CC: ARMYUV420 0
09-05 04:41:04.036: D/Vitamio[Player](1072): onVideoSizeChanged: (424x240)
09-05 04:41:04.106: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] Missing reference picture, default is 0
09-05 04:41:04.106: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] decode_slice_header error
09-05 04:41:04.106: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] Missing reference picture, default is 65538
09-05 04:41:04.196: D/Vitamio[Player](1072): VIDEO: 424x240x1.766667, Surface: 424x240, LP: 768x434, Window: 768x1184x0.648649
09-05 04:41:04.196: D/Vitamio[Player](1072): onPrepared
09-05 04:41:04.246: E/Vitamio[4.2.1][Player](1072): [h264 @ 0xb88994c0] Missing reference picture, default is 65540
09-05 04:41:04.266: D/Vitamio[Player](1072): VIDEO: 424x240x1.766667, Surface: 424x240, LP: 768x434, Window: 768x1184x0.648649
09-05 04:41:04.276: I/Vitamio[Player](1072): Info (701, 0)
09-05 04:41:04.276: D/Vitamio[Player](1072): onInfo: (701, 0)
09-05 04:41:04.806: D/dalvikvm(1072): GC_FOR_ALLOC freed 242K, 9% free 3143K/3448K, paused 75ms, total 76ms
09-05 04:41:05.086: W/dalvikvm(1072): JNI WARNING: JNI function EnsureLocalCapacity called with exception pending
09-05 04:41:05.086: W/dalvikvm(1072): in Ldalvik/system/NativeStart;.run:()V (EnsureLocalCapacity)
09-05 04:41:05.086: W/dalvikvm(1072): Pending exception is:
09-05 04:41:05.126: I/dalvikvm(1072): java.lang.SecurityException: ConnectivityService: Neither user 10056 nor current process has android.permission.ACCESS_NETWORK_STATE.
09-05 04:41:05.126: I/dalvikvm(1072): at android.os.Parcel.readException(Parcel.java:1465)
09-05 04:41:05.126: I/dalvikvm(1072): at android.os.Parcel.readException(Parcel.java:1419)
09-05 04:41:05.126: I/dalvikvm(1072): at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:813)
09-05 04:41:05.136: I/dalvikvm(1072): at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:560)
09-05 04:41:05.136: I/dalvikvm(1072): at io.vov.vitamio.utils.Device.getIdentifiers(Device.java:58)
09-05 04:41:05.136: I/dalvikvm(1072): at io.vov.vitamio.utils.Device.getDeviceFeatures(Device.java:42)
09-05 04:41:05.136: I/dalvikvm(1072): at dalvik.system.NativeStart.run(Native Method)
09-05 04:41:05.136: I/dalvikvm(1072): "Thread-82" prio=5 tid=12 NATIVE
09-05 04:41:05.136: I/dalvikvm(1072): | group="main" sCount=0 dsCount=0 obj=0xb3e30f38 self=0xb886b498
09-05 04:41:05.136: I/dalvikvm(1072): | sysTid=1144 nice=0 sched=0/0 cgrp=apps handle=-1198133984
09-05 04:41:05.136: I/dalvikvm(1072): | state=R schedstat=( 190000000 790000000 432 ) utm=14 stm=5 core=0
09-05 04:41:05.196: D/Vitamio[Player](1072): onVideoSizeChanged: (424x240)
09-05 04:41:05.256: D/Vitamio[Player](1072): VIDEO: 424x240x1.766667, Surface: 424x240, LP: 768x434, Window: 768x1184x0.648649
09-05 04:41:05.266: D/Vitamio[Player](1072): onVideoSizeChanged: (424x240)
09-05 04:41:05.266: D/Vitamio[Player](1072): VIDEO: 424x240x1.766667, Surface: 424x240, LP: 768x434, Window: 768x1184x0.648649
09-05 04:41:05.336: I/dalvikvm(1072): #00 pc 0000132e /system/lib/libcorkscrew.so (unwind_backtrace_thread+29)
09-05 04:41:05.336: I/dalvikvm(1072): #01 pc 000603ea /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+33)
09-05 04:41:05.336: I/dalvikvm(1072): #02 pc 000543e4 /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+395)
09-05 04:41:05.336: I/dalvikvm(1072): #03 pc 00054452 /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
09-05 04:41:05.346: I/dalvikvm(1072): #04 pc 0003871c /system/lib/libdvm.so
09-05 04:41:05.346: I/dalvikvm(1072): #05 pc 00040ea0 /system/lib/libdvm.so
09-05 04:41:05.356: I/dalvikvm(1072): #06 pc 00019130 /data/data/com.test.bufferapp/libs/libvplayer.so
09-05 04:41:05.356: I/dalvikvm(1072): #07 pc 000195b8 /data/data/com.test.bufferapp/libs/libvplayer.so
09-05 04:41:05.356: I/dalvikvm(1072): #08 pc 0000d060 /system/lib/libc.so (__thread_entry+72)
09-05 04:41:05.356: I/dalvikvm(1072): #09 pc 0000d1f8 /system/lib/libc.so (pthread_create+240)
09-05 04:41:05.356: I/dalvikvm(1072): at dalvik.system.NativeStart.run(Native Method)
09-05 04:41:05.356: E/dalvikvm(1072): VM aborting
09-05 04:41:05.356: A/libc(1072): Fatal signal 6 (SIGABRT) at 0x00000430 (code=-6), thread 1144 (.test.bufferapp)
list 文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.bufferapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="io.vov.vitamio.activity.InitActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
android:launchMode="singleTop"
android:theme="@android:style/Theme.NoTitleBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
最佳答案
您遇到此错误:
java.lang.SecurityException: ConnectivityService: Neither user 10056 nor current process has android.permission.ACCESS_NETWORK_STATE.
添加
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
在 list 文件中,并检查。
希望对您有所帮助。
关于Android 应用程序因 Vitamio Library 而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25682055/
我正在成功使用Vitamio bundle 包传输音频,但是在某些情况下,我必须播放本地音频。在 MediaPlayerDemo_Audio Activity 中,代码表示在这种情况下,如果您要播放音
我尝试流式传输(渐进式,例如:http://server.com/video.mp4) 当我使用标准的谷歌媒体播放器(android 包中的 VideoView)并注册一个 onBufferingUp
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 9 年前。 Improve this
我正在玩 Vitamio 演示,喜欢我所看到的。但是,我需要稍微自定义 ffmpeg 源代码(修改 http.c,以便将 http 流的默认设置设置为不可搜索)。我已按照步骤 HERE为了重建 lib
有没有人成功修改过Vitamio中使用的ffmpeg的版本?我已经应用了一个适用于 linux 的补丁,并将其编译为适用于 android 的 libffmpeg.so。如何让 Vitamio 从这个
我使用 Vitamio 库为 Android 手机制作 RTSP 流媒体应用程序。现在我需要为播放器创建一个播放/暂停按钮。通常我可以使用 mVideoView.setMediaController(
我使用 vitamio player(5.0.0 版)在我的 android 应用程序中播放一些视频。视频播放过程中,视频标题显示在屏幕底部。如何从屏幕上删除或更改此文本? 第二个问题 - 如何在 v
我成功安装了Zi库和VitamioBundle,但是无法编译VitamioDemo示例。 Eclipse 说方法 setVideoPath、setVideoQuality、setMediaContro
我正在尝试播放原始文件夹中的 mp4 视频。它在原生视频播放器中运行良好,但当我尝试使用 vitamio 播放它时,它对我不起作用。有什么方法可以使用 vitamio 库从 android 中的原始文
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
我编辑 VideoViewDemo 是因为我需要两个(或更多)相同布局的流 rtsp。 我使用带有两个 VideoView 的相对布局,并在 VideoViewDemo 中添加代码来填充每个表面。 结
我正在考虑在 Android 中制作视频应用。我开始知道有两个著名的库,FFMPEG 和 Vitamio。 我只想知道我可以使用这两个库执行简单的视频功能,例如播放视频、抓取帧、将视频转换为 mp3
我正在编写 Android 应用程序,它使用来自服务器的 HLS 视频流,有时来自本地文件。 哪个更容易实现?哪一个具有更好的性能和功能?我想知道exoplayer和vitamio(标准版)的优缺点。
我正在尝试使用 Vitamio要运行 RTSP 视频流,我在更新它以通过 VideoViewDemo Activity 运行流后使用 Vitamio-sample: public class Vide
我正在尝试使用 Vitamio VideoView 在我的应用程序中播放流媒体视频。我已经下载了 vitamio 演示应用程序,它在我的网址上运行良好。但是,当我尝试在我的应用程序中使用它时,它会在“
我正在使用 Vitamio 插件播放直播。它运作良好。但我无法自定义其 VideoPlayer。任何人都可以告诉我如何: 1/加载流媒体时自动播放。我正在使用这段代码,但效率不高 mVideoView
大约一周后……我想是时候问问 SO 社区了 :) 现在我已经有一个工作(正在进行中)插件已经做到了这一点。 扩展 CordovaPlugin 的 java 文件: Intent objIntent =
我正在做一个项目,必须使用Aes128(Rijndael)方法播放加密文件!并且不应该一开始就完全解密文件并全部播放。我必须解密并即时播放 512 字节 block 的文件。 如何使用 vitamio
我正在尝试使用 Vitamio SDK,但是当我将库添加到我的项目时,apk 变得太大(大约 20Mb 或更大)。 我将库作为项目添加到 Eclipse 中。 我想,我应该添加 .jar 库,但是当我
我编辑了VideoViewDemo.java(官网提供的Android Vitamio demo),目的是添加cookies到Vitamio生成的请求头中。 (标题是在使用方法“setVideoPat
我是一名优秀的程序员,十分优秀!