패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.2

flutter_torrent_streamer

torrent/magnet 링크에서 비디오를 직접 스트리밍할 수 있는 플러터 플러그인입니다.

30일 다운로드
36
좋아요
29
Pub 점수
30

패키지 설치

flutter pub add flutter_torrent_streamer

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

토렌트 및 마그넷 링크에서 비디오를 직접 스트리밍할 수 있는 플러터 플러그인입니다. 완전한 다운로드 없이 피어 투 피어 기술을 활용하여 콘텐츠를 가져와 재생할 수 있어, 가벼운 미디어 소비에 이상적입니다. 이 플러그인은 플러터 앱에 쉽게 통합되며, 유효한 토렌트 또는 마그넷 URL에서 스트림을 시작하기 위한 간단한 API를 제공합니다. 최소한의 설정으로 설계되어 다운로드 중 실시간 재생을 지원하며, 원하는 시점에 비디오를 제공하는 애플리케이션에 적합합니다.

사용 사례

  • 토렌트 링크에서 비디오 스트리밍
  • 마그넷 URI를 통한 미디어 재생
  • 경량 비디오 플레이어 구축
  • 오프라인 준비 스트리밍 활성화
  • P2P 비디오 재생 통합

주요 기능

  • 직접 토렌트/매그넷 스트리밍
  • 다운로드 중 실시간 재생
  • 최소 통합 노력
  • 크로스 플랫폼 호환성
  • torrent 파일과 마그넷 링크를 모두 지원합니다

적합한 대상

  • 미디어 앱 개발자
  • P2P 스트리밍 애플리케이션
  • 요청 시 비디오 플랫폼
  • 저용량 저장 미디어 접근이 필요한 앱
  • 간단한 토렌트 통합을 원하는 개발자

고려 사항

  • 안정적인 인터넷 연결이 필요합니다
  • 트래커의 가용성에 따라 다릅니다
  • 일부 지역에서는 법적 제한에 직면할 수 있습니다
  • 성능은 네트워크 상태에 따라 달라집니다
  • 내장된 토렌트 시딩 기능 없음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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.

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.