如何在Android的不同视图中并排同时播放多个视频文件 [英] How to play multiple video files simultaneously in one layout side by side in different view in Android

查看:100
本文介绍了如何在Android的不同视图中并排同时播放多个视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android 中,我创建了一个并排具有三个表面视图的布局,我想同时使用不同的媒体播放器播放一个视频文件.但是我遇到的一个问题是三个人都不能同时播放该视频.他们中的一两个停止了显示.如果我直接使用视频视图而不是媒体播放器类,但问题仍然存在.请任何人都可以提供帮助.问题是为了什么?它给出了错误表面创建失败的本机错误.我尝试了不同的组合,例如三个不同视图中的一个文件,三个不同视图中的三个文件,但问题尚未解决.其他网站上的一些回复说这取决于内核版本.如果它取决于内核版本,请您给我任何 android 网站上取决于内核版本的 android 文档链接.或者可以玩,请给我代码步骤.这是错误日志 -

In Android, I created a layout with three surface view side by side, and I want to play one video file with different media player simultaneously. But one problem I faced that none of three can play that video simultaneously. One or two of them getting stopped the display. If I used video view instead of Media Player class directly, but the problem remains the same. Please anybody can help. What the problem is for? It is giving error surface creation failed native error. I tried different combination such as one file in 3 different view, three files in three different view, but the problem is not fixed yet. Some replies in other web site says that it depends on kernel version. If it depends on Kernel version, please can you give me any android documentation link on android site that it depends on kernel version. Or it is possible to play, please give me the steps of code. This is error log -

04-10 19:23:37.995: E/ANDROID_DRM_TEST(2573): Client::notify In
04-10 19:23:37.995: V/AudioPolicyManager(2573): startOutput() output 1, stream 3,  session 131
04-10 19:23:37.995: V/AudioPolicyManager(2573): getDeviceForStrategy() from cache strategy 0, device 2
04-10 19:23:37.995: V/AudioPolicyManager(2573): getNewDevice() selected device 2
04-10 19:23:37.995: V/AudioPolicyManager(2573): setOutputDevice() output 1 device 2 delayMs 0
04-10 19:23:37.995: V/AudioPolicyManager(2573): setOutputDevice() setting same device 2 or null device for output 1
04-10 19:23:37.995: I/AudioFlinger(2573): start output streamType (0, 3) for 1
04-10 19:23:37.995: D/AudioHardwareYamaha(2573): AudioStreamOut::setParameters(keyValuePairs="start_output_streamtype=3")
04-10 19:23:38.010: W/SEC_Overlay(2689): overlay_setPosition(0) 0,0,200,397 => 0,0,200,397
04-10 19:23:38.010: I/SEC_Overlay(2689): overlay_setParameter param[4]=4
04-10 19:23:38.010: D/SEC_Overlay(2689): dst width, height have changed [w= 200, h= 397] -> [w=200, h= 397]
04-10 19:23:38.010: I/SEC_Overlay(2689): Nothing to do!
04-10 19:23:38.090: E/VideoMIO(2573): AndroidSurfaceOutput::setParametersSync()  VIDEO ROTATION 0
04-10 19:23:38.090: E/VideoMIO(2573): AndroidSurfaceOutput::setParametersSync()  VIDEO RENDERER 1
04-10 19:23:38.090: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.090: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.090: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.195: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.195: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.195: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.230: E/VideoMIO(2573): AndroidSurfaceOutput::setParametersSync()  VIDEO ROTATION 0
04-10 19:23:38.230: E/VideoMIO(2573): AndroidSurfaceOutput::setParametersSync()  VIDEO RENDERER 1
04-10 19:23:38.230: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.230: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.230: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.295: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.295: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.295: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.330: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.330: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.330: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.395: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.395: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.395: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.435: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.435: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.435: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.495: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48
04-10 19:23:38.495: E/SEC_Overlay(2689): Error - overlays already in use
04-10 19:23:38.495: D/VideoMIO(2573): Overlay create failed - retrying
04-10 19:23:38.535: D/SEC_Overlay(2689): overlay_createOverlay:IN w=128 h=96 format=48

推荐答案

我找到了一个解决方案.只需将/system/build.prop 替换为以下 build.prop -

I've found one solution. Just replace /system/build.prop with this following build.prop -

构建.prop

# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=GINGERBREAD
ro.build.display.id=GINGERBREAD.EG14
ro.build.version.incremental=EG14
ro.build.version.sdk=10
ro.build.version.codename=REL
ro.build.version.release=2.3.4
ro.build.date=Thu Jul 14 12:16:01 KST 2011
ro.build.date.utc=1310613361
ro.build.type=user
ro.build.user=se.infra
ro.build.host=SEI-28
ro.build.tags=release-keys
ro.product.model=SHW-M250S
ro.product.brand=samsung
ro.product.name=SHW-M250S
ro.product.device=SHW-M250S
ro.product.board=SHW-M250S
ro.product.cpu.abi=armeabi-v7a
# Samsung Specific Properties
ro.build.PDA=M250S.EG14.1208
ro.build.hidden_ver=M250S.EG14.1208
ro.b uild.changelist=380592
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=samsung
ro.product.locale.language=ko
ro.product.locale.region=KR
ro.wifi.channels=
ro.board.platform=s5pc210
# ro.build.product is obsolete; use ro.product.device
ro.build.product=SHW-M250S
# Do not try to parse ro.build.description or .fingerprint
ro.build.description=SHW-M250S-user 2.3.4 GINGERBREAD EG14 release-keys
ro.build.fingerprint=samsung/SHW-M250S/SHW-M250S:2.3.4/GINGERBREAD/EG14:user/release-keys
# Samsung Specific Properties
ro.build.PDA=M250S.EG14.1208
ro.build.hidden_ver=M250S.EG14.1208
ro.build.changelist=380592
ro.build.fota_ver=SSNT11GINGEREG14
ro.tether.denied=false
ro.flash.resolution=1080
# end build properties
#
# system.prop for asop5000
#

rild.libpath=/system/lib/libsec-ril.so
rild.libargs=-d /dev/ttyS0
ro.sf.lcd_density=240
dalvik.vm.heapsize=64m

# Samsung USB default mode
persist.service.usb.setting=2

#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.setupwizard.mode=OPTIONAL
ro.com.google.gmsversion=2.3_r4
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-rtsp=true
ro.com.google.clientidbase=android-samsung
ro.com.google.clientidbase.ms=android-skt-kr
ro.com.google.clientidbase.am=android-skt-kr
ro.com.google.clientidbase.gmm=android-samsung
ro.com.google.clientidbase.yt=android-samsung
ro.url.legal=http://www.google.com/intl/%s/mobile/android/basic/phone-legal.html
ro.url.legal.android_privacy=http://www.google.com/intl/%s/mobile/android/basic/privacy.html
ro.com.google.locationfeatures=1
keyguard.no_require_sim=true
ro.config.ringtone=Over_the_horizon.ogg
ro.config.notification_sound=Sherbet.ogg
ro.config.alarm_alert=Good_Morning.ogg
ro.config.media_sound=Over_the_horizon.ogg
ro.opengles.version=131072
ro.csc.sales_code=MSK
ro.secdevenc=true
ro.wtldatapassword=true
net.bt.name=Android
dalvik.vm.stack-trace-file=/data/anr/traces.txt

首先用 USB 连接你的三星 Galaxy s-II 并输入命令提示符来安装你的系统 -

At first connect your Samsung Galaxy s-II with usb and type in command prompt to mount your system -

cmd:> adb remount

然后替换文件并重新启动您的设备 -

and then replace the file and reboot your device -

cmd:> adb shell
#reboot

我注意到默认情况下,此设备使用 opencore 框架而不是 libstagefright.并且opencore有一些问题,这就是抛出中殿错误的原因.但是 libstagefright 已经在 android 2.3 版本中实现了.看看 build.prop 文件,stagefright 是禁用的.它是启用 libstagefright 框架并支持 libstagefright 框架的最佳解决方案.您也可以播放 MPEG-2TS 文件,它支持同时播放多个视频文件,没有任何问题.尝试并享受.

I've noticed that by default this device uses opencore framework instead of libstagefright. And opencore has some problem, that's why the nave error is throwing. But libstagefright is already implemented in android version 2.3. Have a look at the build.prop file, the stagefright is disable. It is the best solution to enable to libstagefright framework and do support libstagefright framework. You can play MPEG-2TS file also and it supports to play multiple video file simultaneously without having any problem. Try it and enjoy.

这篇关于如何在Android的不同视图中并排同时播放多个视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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