パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.0.2

flutter_torrent_streamer

torrent/magnet リンクからビデオを直接ストリーミングするためのFlutterプラグイン。

30日間ダウンロード
36
いいね数
29
Pub ポイント
30

パッケージをインストール

flutter pub add flutter_torrent_streamer

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Torrentおよびマグネットリンクからのビデオの直接ストリーミングを可能にするFlutterプラグインです。完全なダウンロードなしで、ピアツーピア技術を利用してコンテンツを取得・再生するため、軽量なメディア消費に最適です。このプラグインはFlutterアプリにシームレスに統合でき、有効なTorrentまたはマグネットURLからストリームを開始するためのシンプルなAPIを提供します。最小限のセットアップで設計されており、ダウンロード中にリアルタイム再生をサポートしているため、オンデマンド動画アプリに適しています。

用途

  • Torrentリンクからの動画ストリーミング
  • マグネットURI経由でのメディア再生
  • 軽量な動画プレイヤーの構築
  • オフライン対応のストリーミングを有効化する
  • P2P動画再生の統合

主な機能

  • 直接的なTorrent/マグネットストリーミング
  • ダウンロード中のリアルタイム再生
  • 最小限の統合作業
  • クロスプラットフォーム互換性
  • Torrentファイルとマグネットリンクの両方をサポートしています

適している対象

  • メディアアプリ開発者
  • P2Pストリーミングアプリケーション
  • オンデマンド動画プラットフォーム
  • 低容量ストレージメディアアクセスを必要とするアプリ
  • 簡単なトーレント統合を求める開発者

注意事項

  • 安定したインターネット接続が必要です
  • トラッカーの利用可能性に依存します
  • 一部の地域では法的制限に直面する可能性があります
  • パフォーマンスはネットワーク状態によって異なります
  • 組み込みのTorrentシーディング機能なし

元の 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 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。