Flutter - VideoPlayer - Support http headers while constructing video controller from network datasource

1,201

Solution 1

you can use this package called video player with header

Solution 2

Now, the video_player plugin supports adding httpHeaders while opening videos from the network.

Example:
VideoPlayerController.network(
    'your-video-url',
    httpHeaders: {
        'Authorization': 'Bearer ...',
    },
);

Share:
1,201
TRUSTMEIMJEDI
Author by

TRUSTMEIMJEDI

Updated on December 13, 2022

Comments

  • TRUSTMEIMJEDI
    TRUSTMEIMJEDI over 1 year

    I want to add http headers to video controller from network to pass bearer token to let watch video for only authorized users, I found issue about it on github official flutter repo https://github.com/flutter/plugins/pull/2121 and here also https://github.com/flutter/flutter/issues/16466 nothing is moving on and I need this feature. Is there any way to inject http headers before sending the request for video?

    Thanks for help