video_info_plus 1.0.2 copy "video_info_plus: ^1.0.2" to clipboard
video_info_plus: ^1.0.2 copied to clipboard

A Dart plugin that provides functionality to extract video IDs from YouTube URLs and retrieve thumbnail images.

Video Info Plus #

VideoInfoPlus is a Dart plugin that provides functionality to extract video IDs from YouTube URLs and retrieve thumbnail images for those videos. This plugin is useful for developers who want to integrate YouTube video information into their applications.

pub package

Features #

  • Extract Video ID: Easily extract the video ID from a given YouTube URL.
  • Get Thumbnail URL: Retrieve a placeholder thumbnail URL for a specified YouTube video ID.

Installation #

To use VideoInfoPlus in your Dart or Flutter project, add the following dependency to your pubspec.yaml file:

dependencies:
  video_info_plus: ^1.0.2

Then, run flutter pub get or dart pub get to install the package.

Usage #

Importing the Package #

First, import the package in your Dart file:

import 'package:video_info_plus/video_info_plus.dart';

Extracting Video ID #

To extract the video ID from a YouTube URL, use the getVideoIdFromUrl method:

final videoInfoPlus = VideoInfoPlus();
String videoId = videoInfoPlus.getVideoIdFromUrl(url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
print('Video ID: $videoId');

Getting Thumbnail URL #

To get the thumbnail URL for a YouTube video, use the getThumbnailUrl method:

String thumbnailUrl = videoInfoPlus.getThumbnailUrl(url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
print('Thumbnail URL: $thumbnailUrl');

Example #

Here's a complete example of how to use the VideoInfoPlus plugin:

import 'package:video_info_plus/video_info_plus.dart';

void main() {
  final videoInfoPlus = VideoInfoPlus();
  
  String url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
  
  String videoId = videoInfoPlus.getVideoIdFromUrl(url: url);
  print('Video ID: $videoId');
  
  String thumbnailUrl = videoInfoPlus.getThumbnailUrl(url: url);
  print('Thumbnail URL: $thumbnailUrl');
}

Running the Example #

To run the example, create a new Dart or Flutter project, copy the example code into the main.dart file, and execute the project using your preferred IDE or command line.

Contributing #

Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.

License #

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

Acknowledgments #

  • Thanks to the Dart and Flutter communities for their support and resources.
1
likes
160
points
48
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

A Dart plugin that provides functionality to extract video IDs from YouTube URLs and retrieve thumbnail images.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on video_info_plus