Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid MediaPlayer: prepared video takes 250ms to start playing
    primarykey
    data
    text
    <p>When I play a video, using prepareAsync(), then calling start() when the video is prepared, it takes about 250ms from my start() call to when the video actually starts to play. Is that just how it is, or is something funny going on here? Note that the video is in the raw directory. In my activity's OnCreate I have:</p> <pre><code>private VideoView vv; private MediaPlayer mp = new MediaPlayer(); vv = (VideoView)findViewById(R.id.vv); vv.getHolder().addCallback(this); mp.reset(); mp.setDisplay( vv.getHolder() ); mp.setDataSource( this, Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.moviename) ); Log.d(TAG,"video is preparing"); mp.prepareAsync(); </code></pre> <p>Then there is the listener:</p> <pre><code>@Override public void onPrepared(MediaPlayer arg0) { Log.d(TAG, "video is prepared"); mp.start(); } </code></pre> <p>Actually my code is more complicated than this. The user clicks a button to play the video and can also select different videos. I have an image hiding the video, and at a certain number of ms from mp.start() I pull this image away and reveal the video. On my device I have to set this at 250ms to reliably not reveal something other than the video (that something is either black or the last frame of the previous video played).</p> <p>What I'm wondering is whether you can tell from my logcat that something is not right with this. I'm curious about the messages that aren't titled ButtonBookActivity. Are they normal? These are mp4s. Note that preparing the video in this case takes only 120ms.</p> <pre><code>04-15 13:30:05.600: D/ButtonBookActivity(1238): video is reset 04-15 13:30:05.620: I/NuCachedSource2(83): ERROR_END_OF_STREAM 04-15 13:30:05.630: D/AwesomePlayer(83): Failed to open file, all profile flags have to set through setprop method. 04-15 13:30:05.630: I/MPEG4Extractor(83): NON-QT MODE DECIDED 04-15 13:30:05.640: I/SampleTable(83): There are reordered frames present. 04-15 13:30:05.640: D/ButtonBookActivity(1238): video is preparing 04-15 13:30:05.640: I/OMXCodec(83): [OMX.Nvidia.h264.decode] AVC profile = 77 (Main), level = 32 04-15 13:30:05.640: I/OMXCodec(83): [OMX.Nvidia.h264.decode] video dimensions are 800 x 1280 04-15 13:30:05.640: I/OMXCodec(83): [OMX.Nvidia.h264.decode] Crop rect is 800 x 1280 @ (0, 0) 04-15 13:30:05.760: D/ButtonBookActivity(1238): video is prepared 04-15 13:30:06.540: D/ButtonBookActivity(1238): touch event 04-15 13:30:06.540: D/ButtonBookActivity(1238): button clicked 04-15 13:30:06.550: D/ButtonBookActivity(1238): calling playmovie in onTouch callback 04-15 13:30:06.550: D/ButtonBookActivity(1238): playing movie 04-15 13:30:06.550: D/ButtonBookActivity(1238): delaying movie reveal 04-15 13:30:06.560: D/NvOsDebugPrintf(83): Allocating new output: 800x1280 (x 12) 04-15 13:30:06.570: I/OMXCodec(83): [OMX.Nvidia.h264.decode] video dimensions are 800 x 1280 04-15 13:30:06.570: I/OMXCodec(83): [OMX.Nvidia.h264.decode] Crop rect is 800 x 1280 @ (0, 0) 04-15 13:30:06.620: D/ButtonBookActivity(1238): touch event 04-15 13:30:06.620: D/ButtonBookActivity(1238): ignoring touch event 04-15 13:30:06.770: V/NvAudioALSA(83): open called for devices 00000002 in mode 0... 04-15 13:30:06.770: V/NvAudioALSA(83): getAlsaDeviceName::devices 0x2 IsVoiceCallDevice 0 devName music 04-15 13:30:06.770: V/NvAudioALSA(83): Reset buffer size to 4096 and latency to 92879 04-15 13:30:06.770: V/NvAudioALSA(83): Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian) 04-15 13:30:06.770: V/NvAudioALSA(83): Using 2 channels for PLAYBACK. 04-15 13:30:06.770: V/NvAudioALSA(83): Set PLAYBACK sample rate to 44100 HZ 04-15 13:30:06.770: V/NvAudioALSA(83): Buffer size: 4096 04-15 13:30:06.770: V/NvAudioALSA(83): Period size: 1024 04-15 13:30:06.770: V/NvAudioALSA(83): Latency: 92879 04-15 13:30:06.770: V/NvAudioALSA(83): Period Time: 23219 04-15 13:30:06.770: V/NvAudioALSA(83): Periods: 4 04-15 13:30:07.060: V/NvAudioALSA(83): Initialized ALSA PLAYBACK device music 04-15 13:30:09.550: D/ButtonBookActivity(1238): video completed </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload