mrmaffen / vlc-android-sdk

VLC Android SDK pushed to Maven Central. Primarily used in project tomahawk-android.
792 stars 244 forks source link

strange onNewVideoLayout callback #121

Closed KnIfER closed 6 years ago

KnIfER commented 6 years ago

in earlier version,onNewLayout works fine.
but in the new onNewVideoLayout listener

onNewVideoLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen)

width is always 10,height 0,visibleHeight 0,visibleWidth 0.thus I cannot handle the scaling of a videoview by this callback

KnIfER commented 6 years ago

temporary:

    MediaMetadataRetriever retr = new MediaMetadataRetriever();
    retr.setDataSource(mMediaPlayer.getMedia().getUri().getPath());
    height = Integer.valueOf(retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)); // 视频高度
    width =  Integer.valueOf(retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH) ) ; // 视频宽度
PineapplePie commented 6 years ago

I've asked vlc team about it, take a look - https://code.videolan.org/videolan/vlc-android/issues/523. You need to add option "--vout=android-display".

KnIfER commented 6 years ago

Thank you!It's working now.
what's more,I found that the on-start greenish display has vanished.
and that the seek behaviour looks more fluent.
so it must be an important option to add for vlc-android!

    ArrayList<String> options = new ArrayList(1);
    options.add("--vout=android-display");
    mLibVLC = new LibVLC(this,options);