wang-bin / fvp

Flutter video player plugin for all desktop+mobile platforms. download prebuilt examples from github actions. https://pub.dev/packages/fvp
BSD 3-Clause "New" or "Revised" License
197 stars 31 forks source link

Fix the mdk Android example #148

Closed DovgopolsSerj closed 2 months ago

DovgopolsSerj commented 2 months ago

The android example does not work on version 0.26.0 https://github.com/wang-bin/mdk-examples/blob/master/flutter/simple/lib/multi_textures.dart It needs to fix the initState method. That's how it works

@override
void initState() {
  super.initState();
  player.media = 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4';
  player.prepare().then((_){  
    player.updateTexture();
    player.loop = -1;
    player.state = PlaybackState.playing;
  });
}

And it may be useful to emphasize that the prepare method "..decode the first frame.." but it does not output it to the texture. This is important when playing audio files. If you use this method to prepare an mp3 file, the texture will be empty. But if you call player.seek(0) before updateTexture, then the texture will have a cover from the file.

wang-bin commented 2 months ago

try fvp master branch