I has this following code to show a VideoView on top of anything that is showing on my screen.
public void showVideo(float x, float y) {
AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams) video.getLayoutParams();
params.width=190;
params.height=240;
params.x = (int) x;
params.y = (int) y;
video.requestLayout();
video.setVisibility(View.VISIBLE);
video.setVideoURI(Uri.parse("file://sdcard/test-edition/sample.mp4"));
video.start();
}
(Yeah this use AbsoluteLayout, I need show it on top at specific locations (any other solutions for this is appreciated)).
This path to "file://sdcard/test-edition/sample.mp4" is a valid mp4 that I downloaded for tests purpose.
When showing it the system only says "Impossible to play video. A error ocurred.", but there's no stacktrace on Logcat. If it's usefull I has this verbose infos when trying to run it:
VERBOSE/MediaPlayer-JNI(824): native_setup
VERBOSE/MediaPlayer(824): constructor
VERBOSE/MediaPlayer(824): setListener
VERBOSE/MediaPlayer-JNI(824): setDataSource: path /test-edition/sample.mp4
VERBOSE/MediaPlayer(824): setDataSource(/test-edition/sample.mp4)
VERBOSE/PVPlayer(2417): PVPlayer constructor
VERBOSE/PVPlayer(2417): construct PlayerDriver
VERBOSE/PlayerDriver(2417): constructor
VERBOSE/PlayerDriver(2417): OpenCore hardware module not found
VERBOSE/PlayerDriver(2417): start player thread
VERBOSE/PlayerDriver(2417): startPlayerThread
VERBOSE/PlayerDriver(2417): InitializeForThread
VERBOSE/PlayerDriver(2417): OMX_MasterInit
VERBOSE/PlayerDriver(2417): OsclScheduler::Init
VERBOSE/PlayerDriver(2417): CreatePlayer
DEBUG/(2417): SISO TEST registering PVMFRecognizerPluginFactory
DEBUG/(2417): SISO TEST registering PVMFRecognizerPluginFactory success
VERBOSE/PlayerDriver(2417): AddToScheduler
VERBOSE/PlayerDriver(2417): PendForExec
VERBOSE/PlayerDriver(2417): OsclActiveScheduler::Current
VERBOSE/PlayerDriver(2417): StartScheduler
VERBOSE/PVPlayer(2417): send PLAYER_SETUP
VERBOSE/PlayerDriver(2417): Send player code: 2
VERBOSE/PlayerDriver(2417): CommandCompleted
VERBOSE/PlayerDriver(2417): Completed command PLAYER_SETUP status=1
VERBOSE/PVPlayer(2417): setDataSource(/test-edition/sample.mp4)
INFO/PlayerDriver(2417): PlayerDriver::isProtectedFile(/test-edition/sample.mp4)
VERBOSE/PlayerDriver(2417): File EXT is : .mp4
ERROR/PlayerDriver(2417): PlayerDriver::it is a not Protected file
VERBOSE/MediaPlayer(824): setVideoSurface
VERBOSE/PVPlayer(2417): setVideoSurface(0x6fd00)
VERBOSE/MediaPlayer-JNI(824): setAudioStreamType: 3
VERBOSE/MediaPlayer(824): MediaPlayer::setAudioStreamType
VERBOSE/MediaPlayer-JNI(824): prepareAsync: surface=0x2cae40 (id=2)
VERBOSE/MediaPlayer(824): setVideoSurface
VERBOSE/PVPlayer(2417): setVideoSurface(0x6fd38)
VERBOSE/MediaPlayer(824): prepareAsync
VERBOSE/PVPlayer(2417): prepareAsync
VERBOSE/PVPlayer(2417): data source = /test-edition/sample.mp4
VERBOSE/PlayerDriver(2417): Send player code: 3
VERBOSE/PlayerDriver(2417): handleSetDataSource
VERBOSE/PlayerDriver(2417): handleSetDataSource- scanning for extension
ERROR/OsclDirectFileIO(2417): [LargeFileSupport] OsclDirectFileIO::OpenFileOrSharedFd Error = -1
VERBOSE/PlayerDriver(2417): HandleInformationalEvent: 26
VERBOSE/PlayerDriver(2417): HandleInformationalEvent: type=26 UNHANDLED
ERROR/MediaPlayerService(2417): Client::notify In
ERROR/MediaPlayer(824): message received msg=200, ext1=1, ext2=26
WARN/MediaPlayer(824): info/warning (1, 26)
ERROR/MediaPlayer(824): callback application
ERROR/MediaPlayer(824): back from callback
VERBOSE/PlayerDriver(2417): CommandCompleted
VERBOSE/PlayerDriver(2417): Completed command PLAYER_SET_DATA_SOURCE status=-4
ERROR/PlayerDriver(2417): Command PLAYER_SET_DATA_SOURCE completed with an error or info -4
ERROR/MediaPlayerService(2417): Client::notify In
ERROR/MediaPlayer(824): message received msg=100, ext1=-4, ext2=-4
ERROR/MediaPlayer(824): error (-4, -4)
ERROR/MediaPlayer(824): callback application
ERROR/MediaPlayer(824): back from callback
VERBOSE/PVPlayer(2417): run_init s=-2147483648, cancelled=0
VERBOSE/PlayerDriver(2417): HandleInformationalEvent: 27
WARN/PlayerDriver(2417): PVMFInfoErrorHandlingComplete
INFO/MediaPlayer(824): Info (1,26)
ERROR/MediaPlayer(824): Error (-4,-4)
DEBUG/VideoView(824): Error: -4,-4
I solved it:
video.setVideoPath("/sdcard/test-edition/sample.3gp");
It's look like it is just a URI parser problem, but the VideoView doesn't say anything usefull.