Recherche avancée

Médias (1)

Mot : - Tags -/sintel

Autres articles (87)

Sur d’autres sites (16254)

  • Can VideoView be detach and reattached without stopping the stream ?

    1er juin 2015, par Thierry-Dimitri Roy

    I’m building an app where the user clicks on a button to show a video full screen. Initially the video is attached to a view inside a ViewPager. To be able to show it fullscreen I detach it from its parent and reattach it to the root view. This works fine, except when the video is switched to fullscreen while playing. When I detach a playing VideoView it just stop and I need to restart it. This is not acceptable since the video starts buffering before resume. Here the part of the code where the detach is done :

       final ViewGroup parent = (ViewGroup) findViewById(R.id.parent);

       final ViewGroup root = (ViewGroup) findViewById(R.id.root);

       Button b = (Button) findViewById(R.id.button);
       b.setOnClickListener(new OnClickListener() {

           @Override
           public void onClick(View v) {
               parent.removeView(mVideoView);

               LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
               root.addView(mVideoView, lp);
           }
       });

    Depending of the device, I have a different log error. Probably because the actual video player is provided by the manufacturer and not the Android SDK. Here are the error logs for a Nexus 7 :

    10-30 20:26:18.618: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Begin
    10-30 20:26:18.618: D/NvOsDebugPrintf(124): --------- Closing TVMR Frame Delivery Thread -------------
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): ------- NvAvpClose -------
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Done
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMLiteTVMRDecPrivateClose Done

    I haven’t been able to detach the video without stopping it. I tried using SurfaceView or TextureView without success.

    I also tried finding a third party video player. I found a commercial one (http://www.vitamio.org/) that I can’t really use for business reason. I found an open source one, that hasn’t been updated in the last year (https://code.google.com/p/dolphin-player/).

    I’m currently targeting Android 4.2 or better on tablet only.


    Note that the ViewPager is not fullscreen. So I can’t use LayoutParams to make the video fullscreen. I need to remove the VideoView from the parent in the ViewPager and add it to the root view to be able to show it fullscreen.

    The URL I’m testing with : http://bellvps1.cpl.delvenetworks.com/media/e1b3e24ecb944abd8f4ed823a0b76ddc/68f78d35296243bfb46d2418f03f2fd0/bande-annonce---the-secret-life-of-walter-mitty-1-9efcc5c6e52ac07a3edf84a1b21967995b7796a2.m3u8

  • Can VideoView be detach and reattached without stopping the stream ?

    17 septembre 2018, par Thierry-Dimitri Roy

    I’m building an app where the user clicks on a button to show a video full screen. Initially the video is attached to a view inside a ViewPager. To be able to show it fullscreen I detach it from its parent and reattach it to the root view. This works fine, except when the video is switched to fullscreen while playing. When I detach a playing VideoView it just stop and I need to restart it. This is not acceptable since the video starts buffering before resume. Here the part of the code where the detach is done :

       final ViewGroup parent = (ViewGroup) findViewById(R.id.parent);

       final ViewGroup root = (ViewGroup) findViewById(R.id.root);

       Button b = (Button) findViewById(R.id.button);
       b.setOnClickListener(new OnClickListener() {

           @Override
           public void onClick(View v) {
               parent.removeView(mVideoView);

               LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
               root.addView(mVideoView, lp);
           }
       });

    Depending of the device, I have a different log error. Probably because the actual video player is provided by the manufacturer and not the Android SDK. Here are the error logs for a Nexus 7 :

    10-30 20:26:18.618: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Begin
    10-30 20:26:18.618: D/NvOsDebugPrintf(124): --------- Closing TVMR Frame Delivery Thread -------------
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): ------- NvAvpClose -------
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Done
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMLiteTVMRDecPrivateClose Done

    I haven’t been able to detach the video without stopping it. I tried using SurfaceView or TextureView without success.

    I also tried finding a third party video player. I found a commercial one (http://www.vitamio.org/) that I can’t really use for business reason. I found an open source one, that hasn’t been updated in the last year (https://code.google.com/p/dolphin-player/).

    I’m currently targeting Android 4.2 or better on tablet only.


    Note that the ViewPager is not fullscreen. So I can’t use LayoutParams to make the video fullscreen. I need to remove the VideoView from the parent in the ViewPager and add it to the root view to be able to show it fullscreen.

    The URL I’m testing with : http://bellvps1.cpl.delvenetworks.com/media/e1b3e24ecb944abd8f4ed823a0b76ddc/68f78d35296243bfb46d2418f03f2fd0/bande-annonce---the-secret-life-of-walter-mitty-1-9efcc5c6e52ac07a3edf84a1b21967995b7796a2.m3u8

  • FFmpeg only reading one channel

    29 août 2017, par AbstractDissonance

    Trying to read a stereo wav file and ffmpeg is only reading one channel. ffprobe returns 2 channels.

    I have used -ac 2 and then added -channel_layout stereo but all return 1 channel(or basically filling half the buffer I created).

    Basically the output size of ffmpeg is about half the wav file size.

    What I would like is for it to return every channel in

    Channel1_sample1, channel2_sample1, ..., ChannelN_sample1, channel1_sample2, etc...

    But, in reality, I’d rather just have it work with stereo ;) I’m giving it plenty large enough buffer to read to, so that isn’t the problem either.

    Here is the output

    ffprobe.exe -hide_banner -v quiet -print_format flat -show_streams -i temp.wav
    streams.stream.0.index=0
    streams.stream.0.codec_name="pcm_s16le"
    streams.stream.0.codec_long_name="PCM signed 16-bit little-endian"
    streams.stream.0.profile="unknown"
    streams.stream.0.codec_type="audio"
    streams.stream.0.codec_time_base="1/44100"
    streams.stream.0.codec_tag_string="[1][0][0][0]"
    streams.stream.0.codec_tag="0x0001"
    streams.stream.0.sample_fmt="s16"
    streams.stream.0.sample_rate="44100"
    streams.stream.0.channels=2
    streams.stream.0.channel_layout="unknown"
    streams.stream.0.bits_per_sample=16
    streams.stream.0.id="N/A"
    streams.stream.0.r_frame_rate="0/0"
    streams.stream.0.avg_frame_rate="0/0"
    streams.stream.0.time_base="1/44100"
    streams.stream.0.start_pts="N/A"
    streams.stream.0.start_time="N/A"
    streams.stream.0.duration_ts=14200200
    streams.stream.0.duration="322.000000"
    streams.stream.0.bit_rate="1411200"
    streams.stream.0.max_bit_rate="N/A"
    streams.stream.0.bits_per_raw_sample="N/A"
    streams.stream.0.nb_frames="N/A"
    streams.stream.0.nb_read_frames="N/A"
    streams.stream.0.nb_read_packets="N/A"
    streams.stream.0.disposition.default=0
    streams.stream.0.disposition.dub=0
    streams.stream.0.disposition.original=0
    streams.stream.0.disposition.comment=0
    streams.stream.0.disposition.lyrics=0
    streams.stream.0.disposition.karaoke=0
    streams.stream.0.disposition.forced=0
    streams.stream.0.disposition.hearing_impaired=0
    streams.stream.0.disposition.visual_impaired=0
    streams.stream.0.disposition.clean_effects=0
    streams.stream.0.disposition.attached_pic=0
    streams.stream.0.disposition.timed_thumbnails=0
    ffmpeg.exe -i temp.wav -loglevel quiet -f s16le -ac 2 -channel_layout stereo -

    temp.wav is just a standard stereo wav file.