8

how to authenticate IAM role user by region, bucket id,access key and sceret key and get video file object and play in video player. Actually we have uploaded video files in AWS S3 and given access grant to one IAM role user.

Now from the flutter app, I need to authenticate the IAM user by accesskey, secretkey, and get the video object & play in a video player without saving or downloading in local.

i tried with plugin,

flutter_aws_s3_client: ^0.5.0

const region = "<region>";
const bucketId = "<bucket id>";
final AwsS3Client s3client = AwsS3Client(
    region: region,
    host: "s3.$region.amazonaws.com",
    bucketId: bucketId,
    accessKey: "<accesskey>",
    secretKey: "<secretkey>");

//object video name 
final response = await s3client.getObject("example_test.m3u8");

here I got the object response as 200, but how can I pass and play this video file in the video player ? is there any way? I have tried with adding HEADER in expo player android video_player_plugin.dart. but no luck.

video player Plugin

video_player: ^0.10.11+1

class _VideoAppState extends State<VideoApp> {
  VideoPlayerController _controller;

  @override
  void initState() {
    super.initState();
    _controller = VideoPlayerController.network('//need to pass the videoUrl of AWS S3')
      ..initialize().then((_) {
        setState(() {});
      });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Video Demo',
      home: Scaffold(
        body: Center(
          child: _controller.value.initialized
              ? AspectRatio(
                  aspectRatio: _controller.value.aspectRatio,
                  child: VideoPlayer(_controller),
                )
              : Container(),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              _controller.value.isPlaying
                  ? _controller.pause()
                  : _controller.play();
            });
          },
          child: Icon(
            _controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
          ),
        ),
      ),
    );
  }

so help me out how to solve this?

Thanks in advance

2
  • 1
    Did you manage to find the solution Commented Apr 19, 2022 at 7:31
  • Same, did you ever work this out via Dart?
    – ajonno
    Commented May 17, 2022 at 21:55

1 Answer 1

0

for that you need follow some steps 1:get access response 2: then redirect or call that video widget so you load that video

Not the answer you're looking for? Browse other questions tagged or ask your own question.