2013-12-13 147 views
2

我的应用程序已集成Vimeo HTML5WebView。在纵向模式下(在所有设备上),视频工作正常,但当方向改变为横向时,视频开始闪烁。
这是发生在平板电脑 - 在7和10英寸的平板电脑。当视频闪烁时,我在logcat中发出警告,窗口已经聚焦,忽略焦点增益。

请参考下面的logcat。
我试着在StackOverflow上查看各种问题,但无法获得体面的解决方案。Webview - 窗口已经聚焦,忽略聚焦增益

12-13 14:15:11.730: D/dalvikvm(505): JIT code cache reset in 1 ms (1048548 bytes 8/0) 
12-13 14:15:11.740: D/dalvikvm(505): GC_EXPLICIT freed 868K, 25% free 18906K/24960K, paused 5ms+7ms, total 131ms 
12-13 14:15:12.521: W/InputMethodManagerService(505): Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected] 
12-13 14:15:12.531: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:12.621: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:16.915: I/AwesomePlayer(180): cache is running low (1.58 secs) , pausing. 
12-13 14:15:16.915: W/MediaPlayer(22724): info/warning (703, 1843) 
12-13 14:15:16.915: W/MediaPlayer(22724): info/warning (701, 0) 
12-13 14:15:16.925: I/MediaPlayer(22724): Info (703,1843) 
12-13 14:15:16.925: I/MediaPlayer(22724): Info (701,0) 
12-13 14:15:19.928: D/audio_hw_primary(180): out_standby: enter: usecase(1: low-latency-playback) 
12-13 14:15:19.988: D/audio_hw_primary(180): stop_output_stream: enter: usecase(1: low-latency-playback) 
12-13 14:15:19.988: D/audio_hw_primary(180): disable_audio_route: reset mixer path: low-latency-playback 
12-13 14:15:19.988: D/audio_hw_primary(180): disable_snd_device: snd_device(2: speaker) 
12-13 14:15:19.998: D/audio_hw_primary(180): stop_output_stream: exit: status(0) 
12-13 14:15:19.998: D/audio_hw_primary(180): out_standby: exit 
12-13 14:15:27.916: I/AwesomePlayer(180): cache has filled up (6.09 secs), resuming. 
12-13 14:15:27.916: W/MediaPlayer(22724): info/warning (702, 0) 
12-13 14:15:27.936: D/audio_hw_primary(180): start_output_stream: enter: usecase(1: low-latency-playback) devices(0x2) 
12-13 14:15:27.936: D/audio_hw_primary(180): select_devices: out_snd_device(2: speaker) in_snd_device(0: none) 
12-13 14:15:27.936: D/audio_hw_primary(180): enable_snd_device: sending audio calibration for snd_device(2) acdb_id(14) 
12-13 14:15:27.936: D/ACDB-LOADER(180): ACDB -> send_afe_cal 
12-13 14:15:27.936: D/audio_hw_primary(180): enable_snd_device: snd_device(2: speaker) 
12-13 14:15:27.946: D/audio_hw_primary(180): enable_audio_route: apply mixer path: low-latency-playback 
12-13 14:15:27.956: D/audio_hw_primary(180): start_output_stream: exit 
12-13 14:15:28.016: I/MediaPlayer(22724): Info (702,0) 
12-13 14:15:29.608: I/InputReader(505): Reconfiguring input devices. changes=0x00000004 
12-13 14:15:29.608: I/InputReader(505): Device reconfigured: id=6, name='elan-touchscreen', size 1200x1920, orientation 1, mode 1, display id 0 
12-13 14:15:29.608: I/InputReader(505): Reconfiguring input devices. changes=0x00000004 
12-13 14:15:29.608: I/InputReader(505): Device reconfigured: id=6, name='elan-touchscreen', size 1200x1920, orientation 1, mode 1, display id 0 
12-13 14:15:29.608: I/ActivityManager(505): Config changes=1480 {1.0 404mcc?mnc en_US ldltr sw600dp w960dp h527dp 320dpi lrg land finger -keyb/v/h -nav/h s.51} 
12-13 14:15:29.678: D/audio_hw_primary(180): adev_set_parameters: enter: rotation=90 
12-13 14:15:29.678: D/audio_hw_primary(180): adev_set_parameters: exit with code(0) 
12-13 14:15:29.748: D/PhoneStatusBar(587): mSettingsPanelGravity = 8388661 
12-13 14:15:29.808: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:29.828: I/WindowManager(505): Screen frozen for +274ms due to Window{4290b200 u0 Panel:com.xx.xxx/com.xx.xxx.WebViewActivity} 
12-13 14:15:29.908: E/CABL(203): MSMFB_HISTOGRAM_STOP failed! 
12-13 14:15:31.970: D/dalvikvm(505): GC_EXPLICIT freed 858K, 25% free 18826K/24960K, paused 7ms+5ms, total 120ms 
12-13 14:15:32.911: W/InputMethodManagerService(505): Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected] 
12-13 14:15:32.921: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:32.961: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:35.924: I/AwesomePlayer(180): cache is running low (1.84 secs) , pausing. 
12-13 14:15:35.934: W/MediaPlayer(22724): info/warning (703, 1811) 
12-13 14:15:35.934: W/MediaPlayer(22724): info/warning (701, 0) 
12-13 14:15:35.934: I/MediaPlayer(22724): Info (703,1811) 
12-13 14:15:35.934: I/MediaPlayer(22724): Info (701,0) 
12-13 14:15:36.064: W/InputMethodManagerService(505): Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected] 
12-13 14:15:36.074: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:36.184: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:36.785: W/MediaPlayer(22724): info/warning (702, 0) 
12-13 14:15:36.785: I/MediaPlayer(22724): Info (702,0) 
12-13 14:15:37.045: I/NuCachedSource2(180): new range: offset= 32665175 
12-13 14:15:38.967: D/audio_hw_primary(180): out_standby: enter: usecase(1: low-latency-playback) 
12-13 14:15:39.007: D/audio_hw_primary(180): stop_output_stream: enter: usecase(1: low-latency-playback) 
12-13 14:15:39.007: D/audio_hw_primary(180): disable_audio_route: reset mixer path: low-latency-playback 
12-13 14:15:39.007: D/audio_hw_primary(180): disable_snd_device: snd_device(2: speaker) 
12-13 14:15:39.007: D/audio_hw_primary(180): stop_output_stream: exit: status(0) 
12-13 14:15:39.007: D/audio_hw_primary(180): out_standby: exit 
12-13 14:15:39.978: D/audio_hw_primary(180): start_output_stream: enter: usecase(1: low-latency-playback) devices(0x2) 
12-13 14:15:39.978: D/audio_hw_primary(180): select_devices: out_snd_device(2: speaker) in_snd_device(0: none) 
12-13 14:15:39.978: D/audio_hw_primary(180): enable_snd_device: sending audio calibration for snd_device(2) acdb_id(14) 
12-13 14:15:39.978: D/ACDB-LOADER(180): ACDB -> send_afe_cal 
12-13 14:15:39.978: D/audio_hw_primary(180): enable_snd_device: snd_device(2: speaker) 
12-13 14:15:39.978: D/audio_hw_primary(180): enable_audio_route: apply mixer path: low-latency-playback 
12-13 14:15:39.978: I/AwesomePlayer(180): cache is running low (0.07 secs) , pausing. 
12-13 14:15:39.978: W/MediaPlayer(22724): info/warning (703, 1625) 
12-13 14:15:39.978: W/MediaPlayer(22724): info/warning (701, 0) 
12-13 14:15:39.978: W/MediaPlayer(22724): info/warning (702, 0) 
12-13 14:15:39.988: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:39.988: D/audio_hw_primary(180): start_output_stream: exit 
12-13 14:15:40.008: V/PhoneStatusBar(587): setLightsOn(true) 
12-13 14:15:40.088: I/MediaPlayer(22724): Info (703,1625) 
12-13 14:15:40.088: I/MediaPlayer(22724): Info (701,0) 
12-13 14:15:40.088: I/MediaPlayer(22724): Info (702,0) 
12-13 14:15:40.088: W/InputMethodManagerService(505): Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected] 
12-13 14:15:40.969: I/AwesomePlayer(180): cache is running low (1.45 secs) , pausing. 
12-13 14:15:40.969: W/MediaPlayer(22724): info/warning (703, 1625) 
12-13 14:15:40.969: W/MediaPlayer(22724): info/warning (701, 0) 
12-13 14:15:40.969: I/MediaPlayer(22724): Info (703,1625) 
12-13 14:15:40.969: I/MediaPlayer(22724): Info (701,0) 
12-13 14:15:42.640: D/dalvikvm(22724): GC_FOR_ALLOC freed 420K, 4% free 11555K/12012K, paused 24ms, total 24ms 
12-13 14:15:43.101: W/InputMethodManagerService(505): Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected] 

请让我知道,如果web视图代码有帮助,我会将它添加到我的问题。从我看到的StackOverflow的问题,我觉得,这可能是一个配置问题,并在我的web视图代码,我已经覆盖,还包括,android:configChanges到WebViewActivity。

@Override 
public void onConfigurationChanged(Configuration newConfig) { 
    super.onConfigurationChanged(newConfig); 
} 
    <activity android:name=".WebViewActivity" 
    android:configChanges="keyboardHidden|orientation|screenSize"/> 

感谢您的帮助!

+0

我也hv webview与vimeo视频集成,但它不会发生这种方式参考:http://stackoverflow.com/questions/15895437/how-to-play-vimeo-video-using-iframe-in-webview – KOTIOS

回答

1

通过将

android:configChanges="orientation" 

为您的活动,你指示你的活动将处理方向变化的系统。但你并没有真正做任何事情,因为你所做的只是:

super.onConfigurationChanged(newConfig); 

那么,如何解决你的问题?

  1. 您说过,只有在大屏幕(平板电脑)和特殊应用程序发生方向更改时,您才会遇到问题。当从肖像改变为风景时。哟在电话设备上发生方向更改时不会看到问题。 这让我觉得视频质量可能不够好,无法在横向模式下播放。真的吗?即如果您最初在横向模式下开始您的活动,您是否仍然看到闪烁?

  2. 你确定这不是一个设备特定问题?即,您所描述的这个问题是出现在所有大屏幕设备还是您正在测试的一个?

  3. 你说你正在使用Vimeo HTML5WebView呈现视频。您是否尝试过该平台提供的常规WebView,并且框架提供的小部件也出现类似的问题?

  4. 最后但并非最不重要的一点是,您始终可以保存播放器的状态(如视频在定位之前的时间戳),然后在定位更改后使用该状态恢复您的网络视图。为此,请自己停止处理配置,然后按照Saving Activity StateHandling configuration changesHandling Runtime Changes中提及的指导进行操作。如果你确信自己可以自己处理配置更改,那就继续做吧,但不要只是调用超级配置,并期望系统能够神奇地为你处理活动对象状态。

希望这会有所帮助。

+0

1.是的,视频质量很好。它在横向模式下播放效果很好。这个我不确定,我测试的所有设备都是4.3。该视频在4.4版本中表现良好,但随后在4.4版本中有所改进,所以真的不能说它的4.3版本具体。将在其他一些平板电脑上进行测试。 3. Vimeo视频是HTML5,因此普通视频不播放视频。 4.将研究它。 –

0

最佳解决方案的每一个做的是在之间的模式景观变化为纵向或纵向到横向暂停视频和离开的WebView的foucus即设置集中假到的WebView后完全恢复的WebView的获得焦点和播放视频。你需要做一些额外的Java脚本编码和JavaScript桥编码,但解决方案将起作用。

相关问题