पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv2.1.0

y_player

YPlayer एक Flutter पैकेज है जो आसानी से उपयोग किया जा सकने वाला YouTube वीडियो प्लेयर विजेट प्रदान करता है

AndroidiOSmacOSWindowsLinux
30-दिन डाउनलोड
132
लाइक
27
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add y_player

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

YPlayer एक Flutter पैकेज है जो Flutter एप्लिकेशन में YouTube वीडियो के एकीकरण को सरल बनाता है। यह एक कस्टमाइज़ किए जा सकने वाले वीडियो प्लेयर विजेट प्रदान करता है जो कई प्लेटफॉर्मों पर YouTube सामग्री को बिना किसी दिक्कत के एम्बेड और प्ले करने के लिए डिज़ाइन किया गया है। कम सेटअप के साथ, डेवलपर्स वीडियो आईडी या URL का उपयोग करके YouTube वीडियो दिखा सकते हैं, जिसमें रिस्पॉन्सिव डिज़ाइन और बुनियादी प्लेबैक नियंत्रण समर्थित हैं। पैकेज प्रत्येक प्लेटफॉर्म पर ऑप्टिमल प्रदर्शन और संगतता के लिए मूल YouTube प्लेयर का उपयोग करता है।

उपयोग

  • एप्स में YouTube वीडियो एम्बेड करना
  • शैक्षिक सामग्री प्लेयर बनाना
  • मीडिया समृद्ध Flutter एप्लिकेशन बनाना
  • वीडियो ट्यूटोरियल का एकीकरण
  • स्ट्रीमिंग या मनोरंजन ऐप विकसित करना

मुख्य विशेषताएँ

  • वीडियो आईडी या URL के साथ सरल वीडियो एम्बेडिंग
  • Android, iOS, macOS, Windows और Linux के लिए समर्थन
  • प्रतिक्रियाशील और कस्टमाइज़ेबल प्लेयर यूआई
  • एंबेडेड प्ले नियंत्रण
  • मूल यूट्यूब प्लेयर एकीकरण

इनके लिए उपयुक्त

  • मीडिया एप्लिकेशन बनाने वाले फ्लटर डेवलपर्स
  • शैक्षिक ऐप निर्माता
  • वीडियो लाइब्रेरी वाले कंटेंट प्लेटफॉर्म
  • YouTube वीडियो प्लेबैक की आवश्यकता वाले ऐप्स

विचार योग्य बातें

  • वीडियो लोड करने के लिए इंटरनेट कनेक्शन की आवश्यकता है
  • बुनियादी नियंत्रणों के आगे सीमित कस्टमाइजेशन
  • YouTube के API उपलब्धता पर निर्भर करता है
  • कुछ प्लेटफॉर्म के लिए अतिरिक्त अनुमतियाँ की आवश्यकता हो सकती है
  • ऑफलाइन वीडियो प्लेबैक के लिए उपयुक्त नहीं

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

YPlayer

Pub

Logo

YPlayer is a Flutter package that provides an easy-to-use YouTube video player widget. It leverages the power of the youtube_explode_dart package for fetching video information.

Features

  • Play YouTube videos directly in your Flutter app
  • Support for fullscreen mode
  • Optional autoplay
  • Video Quality selection
  • Playback speed control
  • Customizable loading and error widgets
  • Easy to use API with play, pause, and stop functionality
  • Callback support for player state changes and progress updates
  • Customizable progress bar colors
  • Improved handling of app lifecycle changes and fullscreen mode
  • Enhanced error handling and recovery
  • Separate handling of video and audio streams for better quality

Installation

Add y_player to your pubspec.yaml file:

dependencies:
  y_player: ^2.0.0

Then run:

flutter pub get

Usage

First, ensure that you initialize the YPlayer in your main.dart:

import 'package:flutter/material.dart';
import 'package:y_player/y_player_main.dart';

void main() {
  YPlayerInitializer.ensureInitialized();
  runApp(MyApp());
}

Here's a simple example of how to use YPlayer in your Flutter app:

import 'package:flutter/material.dart';
import 'package:y_player/y_player_main.dart';

class MyVideoPlayer extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('YPlayer Example')),
      body: YPlayer(
        youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
        onStateChanged: (status) {
          print('Player Status: $status');
        },
        onProgressChanged: (position, duration) {
          print('Progress: ${position.inSeconds}/${duration.inSeconds}');
        },
        onControllerReady: (controller) {
          print('Controller is ready!');
        },
      ),
    );
  }
}

Migrating to 2.0.0

Version 2.0.0 introduces significant changes to address the deprecation of muxed streams in YouTube and to improve overall performance. Here are the key changes:

To migrate your existing code:

  1. Update your pubspec.yaml to use version 2.0.0 or later of y_player.

  2. In your main.dart, add the initialization call:

void main() {
  YPlayerInitializer.ensureInitialized();
  runApp(MyApp());
}
  1. Update your YPlayer widget usage. The basic usage remains the same, but some properties have changed:
YPlayer(
  youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
  color: Colors.red, // New property for customizing controls color
  // materialProgressColors and cupertinoProgressColors are no longer available
)
  1. If you were using ChewieController directly, you'll need to update to use YPlayerController instead.

These changes address the deprecation of muxed streams in YouTube and provide a more robust and efficient video playback experience. The separate handling of video and audio streams allows for better quality options and more flexibility in playback.

API Reference

YPlayer

Constructor:

YPlayer({
  Key? key,
  required String youtubeUrl,
  double? aspectRatio,
  bool autoPlay = true,
  Color? color,
  Widget? placeholder,
  Widget? loadingWidget,
  Widget? errorWidget,
  YPlayerStateCallback? onStateChanged,
  YPlayerProgressCallback? onProgressChanged,
  Function(YPlayerController controller)? onControllerReady,
})
YPlayerController

Methods:

  • play(): Starts or resumes video playback.
  • pause(): Pauses video playback.
  • stop(): Stops video playback and resets to the beginning.

Properties:

  • status: Gets the current status of the player (YPlayerStatus enum).
  • position: Gets the current playback position (Duration).
  • duration: Gets the total duration of the video (Duration).
  • isInitialized: Returns true if the player is fully initialized.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 4 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।