0

I am building an app where users can post images or videos. I am having trouble finding the best way to display the videos. I have tried using the flutter teams video player plugin but I don't want to have to save the video as a file in order to display it. I was hoping for something similar to the Image.memory() constructor. I have since then switched to the Better_Player plugin which has a memory constructor. However, I have not been able to get it to work correctly. For me it just shows a black screen and doesn't display the video. Here is the code for displaying the video.

BetterPlayerListVideoPlayer(
    BetterPlayerDataSource(
        BetterPlayerDataSourceType.MEMORY,
            "",
            bytes: widget.videoData.toList(),
     ),
            configuration: BetterPlayerConfiguration(
             looping: true,
              aspectRatio: 4 / 3,
              autoPlay: false,
              controlsConfiguration: BetterPlayerControlsConfiguration(
                enableOverflowMenu: false,
                showControlsOnInitialize: false,
              ),
            ),
            autoPlay: false,
          )

Image of output from better_player plugin claiming the data source is of file type when I am using memory

I am unsure if I am using the data source correctly. I am passing an array of bytes that is coming from a base64 decoded string. Thanks for any insights. Right now I am just sending the full video as a base64 encoded string from the server. If anyone knows the best practices or a better way to do this please let me know. Thanks in advance.

1 Answer 1

0

I had a similar problem when trying to run BetterPlayer from memory. I solved it by defining the additional parameter videoExtension as "mp4".

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.