如何在Android的不同视图中并排在一个布局中同时播放多个视频文件

问题描述:

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

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

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

build.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

首先将您的三星 Galaxy s-II 连接到 USB 并输入命令提示符以安装您的系统 -

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 有一些问题,这就是抛出 nave 错误的原因.但是 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.