1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Play live stream blob links

Discussão em 'Mobile' iniciado por Stack, Outubro 3, 2024 às 15:03.

  1. Stack

    Stack Membro Participativo

    I want to display some online video links on my Flutter app but I am facing some issues because of the type of the link.
    Example link: **"blob:https://tv.rik.cy/fa6e005a-27b7-4894-aab3-7a3c9ee6de5d"**\ Is there any package that I can use or how can I deal with this type of video?
    I have tried video_player: ^2.9.2 but with no luck
    Sample code following

    import 'package:flutter/material.dart';
    import 'package:video_player/video_player.dart';

    class VideoPlayerWidget extends StatefulWidget {
    final String videoUrl;

    const VideoPlayerWidget({super.key, required this.videoUrl});

    @override
    VideoPlayerWidgetState createState() => VideoPlayerWidgetState();
    }

    class VideoPlayerWidgetState extends State<VideoPlayerWidget> {
    late VideoPlayerController _controller;

    @override
    void initState() {
    super.initState();
    _controller = VideoPlayerController.networkUrl(
    Uri.parse("blob:https://tv.rik.cy/fa6e005a-27b7-4894-aab3-7a3c9ee6de5d"))
    ..initialize().then((_) {
    setState(() {});
    _controller.play();
    });
    }

    @override
    Widget build(BuildContext context) {
    return _controller.value.isInitialized
    ? Scaffold(
    body: Center(
    child: AspectRatio(
    aspectRatio: _controller.value.aspectRatio,
    child: VideoPlayer(_controller),
    ),
    ),
    )
    : const Center(child: CircularProgressIndicator());
    }

    @override
    void dispose() {
    super.dispose();
    _controller.dispose();
    }
    }

    Continue reading...

Compartilhe esta Página