Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev0.0.2

flutter_torrent_streamer

Um plugin do Flutter para transmitir vídeos diretamente de links torrent/magnet.

Downloads em 30 dias
36
Curtidas
29
Pontos Pub
30

Instalar pacote

flutter pub add flutter_torrent_streamer

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

Um plugin Flutter que permite a transmissão direta de vídeos a partir de links torrent e magnéticos. Ele utiliza tecnologia peer-to-peer para buscar e reproduzir conteúdo sem downloads completos, ideal para consumo leve de mídia. O plugin se integra perfeitamente em aplicativos Flutter, oferecendo uma API simples para iniciar streams a partir de URLs válidas de torrent ou magnéticas. Projetado com configuração mínima, suporta reprodução em tempo real durante o download, tornando-o adequado para aplicações de vídeo sob demanda.

Casos de uso

  • Transmissão de vídeos por links de torrent
  • Reproduzindo mídia por meio de URIs magnéticas
  • Construindo reprodutores de vídeo leves
  • Habilitar streaming pronto para offline
  • Integração de reprodução de vídeo P2P

Principais recursos

  • Transmissão direta de torrent/magnet
  • Reprodução em tempo real durante o download
  • Mínimo esforço de integração
  • Compatibilidade multiplataforma
  • Suporta arquivos torrent e links magnéticos

Indicado para

  • Desenvolvedores de aplicativos de mídia
  • Aplicações de streaming P2P
  • Plataformas de vídeo sob demanda
  • Aplicativos que exigem acesso a mídia de baixa capacidade de armazenamento
  • Desenvolvedores procurando integração simples de torrent

Considerações

  • Requer conexão estável com a internet
  • Depende da disponibilidade do rastreador
  • Pode enfrentar restrições legais em algumas regiões
  • O desempenho varia conforme as condições da rede
  • Sem funcionalidade embutida de sementes de torrent

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

Flutter Torrent Streamer

pub

A flutter plugin to stream videos directly from torrent/magnet links.

This plugin is still under development and pull requests to make it better are heavily appreciated

Few Important points to note before using this plugin

  • Has only android support for now. (Help to implement iOS support is highly appreciated)
  • Is still under development and APIs may go through breaking changes.
  • Supports streaming and seeking videos while still being downloaded but is still experimental and has been tested to work on MX Player but does not work with video_player plugin.

Installation

Add below line to your pubspec.yaml and run flutter packages get

flutter_torrent_streamer: ^0.0.2

Example

import 'package:flutter_torrent_streamer/flutter_torrent_streamer.dart';  
  
class TorrentStreamerView extends StatefulWidget {
  @override _TorrentStreamerViewState createState() => _TorrentStreamerViewState();
}  
  
class _TorrentStreamerViewState extends State<TorrentStreamerView> {
  bool isStreamReady = false;
  int progress = 0;
  
  @override  
  void initState() {
    super.initState();
    _addTorrentListeners();
  }
  
  void _addTorrentListeners() {
    TorrentStreamer.addEventListener('progress', (data) {
      setState(() => progress = data['progress']);
    });
    
    TorrentStreamer.addEventListener('ready', (_) {
      setState(() => isStreamReady = true);
    });
  }
    
  Future<void> _startDownload() async {
    await TorrentStreamer.start('torrent-link-here');
  }
  
  Future<void> _openVideo(BuildContext context) async {
    if (progress == 100) {
      await TorrentStreamer.launchVideo();
    } else {
      showDialog(
        builder: (BuildContext context) {
          return AlertDialog(
            title: new Text('Are You Sure?'),
            content: new Text('Playing video while it is still downloading is experimental and only works on limited set of apps.'),
            actions: <Widget>[
              FlatButton(
               child: new Text("Cancel"),
                onPressed: () {
                  Navigator.of(context).pop();
                }
              ),
              FlatButton(
                child: new Text("Yes, Proceed"),
                onPressed: () async {
                  await TorrentStreamer.launchVideo();
                  Navigator.of(context).pop();
                }
              )
            ]
          );
        },
        context: context
      );
    }
  }
 
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          RaisedButton(
            child: Text('Start Download'),
            onPress: _startDownload
          ),
          Container(height: 8),
          RaisedButton(
	        child: Text('Play Video'),
	        onPress: () => _openVideo(context)
	      )
	    ],
	    crossAxisAlignment: CrossAxisAlignment.center,
	    mainAxisAlignment: MainAxisAlignment.start,
	    mainAxisSize: MainAxisSize.max
	  ),
	  padding: EdgeInsets.all(16)
    );
  }
}  

See example app for more detailed usage.

Using in release builds

If you are using proguard in your app then add the below 2 lines to your proguard rules:

-keep class com.frostwire.jlibtorrent.swig.libtorrent_jni {*;}
-keep class com.frostwire.jlibtorrent.swig.** { *; }

TODO

  • Add support for video_player flutter plugin.
  • Make streaming and seeking more robust for while download still in progress.
  • Run torrent streamer server on local network instead of localhost.
  • Add support for iOS.

Categorias

Dependências

Lista de dependências 1 itens

Repositório-fonte

Projetos que usam este pacote

Ainda não há dados.