Skip to content

Commit

Permalink
Merge pull request #916 from sarbagyastha/develop
Browse files Browse the repository at this point in the history
Version 5.1.1
  • Loading branch information
sarbagyastha authored Feb 21, 2024
2 parents 67cd460 + b72befd commit 09a6ec4
Show file tree
Hide file tree
Showing 115 changed files with 3,671 additions and 248 deletions.
66 changes: 42 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,39 +72,57 @@ For API < 20 devices, you might want to forward the video to be played using You
#### Using the player

```dart
YoutubePlayerController _controller = YoutubePlayerController(
initialVideoId: 'K18cpp_-gP8',
params: YoutubePlayerParams(
playlist: ['nPt8bK2gbaU', 'gQDByCdjUXw'], // Defining custom playlist
startAt: Duration(seconds: 30),
showControls: true,
showFullscreenButton: true,
),
);
YoutubePlayerIFrame(
controller: _controller,
aspectRatio: 16 / 9,
YoutubePlayerController? _controller;
void initState() {
super.initState();
_controller = YoutubePlayerController(
initialVideoId: videoId,
flags: YoutubePlayerFlags(autoPlay: true, mute: false, startAt: 0),
);
}
//--------------- in Widget build(BuildContext context) -------------------
YoutubePlayer(
controller: _controller!,
showVideoProgressIndicator: true,
progressIndicatorColor: Colors.amber,
progressColors: ProgressBarColors(
playedColor: Colors.amber,
handleColor: Colors.amberAccent,
),
onReady: () {
_controller!.addListener(listener);
},
),
-------------- OR --------------
```

YoutubePlayerControllerProvider( // Provides controller to all the widget below it.
controller: _controller,
child: YoutubePlayerIFrame(
aspectRatio: 16 / 9,
),
);

// Access the controller as: `YoutubePlayerControllerProvider.of(context)` or `controller.ytController`.
###For FullScreen Support
```dart
YoutubePlayerBuilder(
player: YoutubePlayer(
showVideoProgressIndicator: true,
controller: _controller!,
),
builder: (context, player) {
return Column(
children: [
// some widgets
player,
],
);
},
),
```

## Want to customize the player?
The package provides `YoutubeValueBuilder`, which can be used to create any custom controls.
The package provides `YoutubePlayerBuilder`, which can be used to create any custom controls.

For example, let's create a custom play pause button.
```dart
YoutubeValueBuilder(
YoutubePlayerBuilder(
controller: _controller, // This can be omitted, if using `YoutubePlayerControllerProvider`
builder: (context, value) {
return IconButton(
Expand Down
67 changes: 1 addition & 66 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,66 +1 @@
analyzer:
exclude:
- 'example/**'

linter:
rules:
# STYLE
- camel_case_types
- library_names
- file_names
- library_prefixes
- non_constant_identifier_names
- constant_identifier_names # prefer
- directives_ordering
#- lines_longer_than_80_chars # avoid
- curly_braces_in_flow_control_structures

# DOCUMENTATION
- slash_for_doc_comments
- package_api_docs # prefer # ?
- public_member_api_docs # prefer # ?
#- comment_references # Unused because https://github.com/dart-lang/sdk/issues/36974

# USAGE
- avoid_relative_lib_imports # prefer
- prefer_adjacent_string_concatenation
- prefer_interpolation_to_compose_strings # prefer
- unnecessary_brace_in_string_interps # avoid
- prefer_collection_literals
- avoid_function_literals_in_foreach_calls # avoid
- prefer_iterable_whereType
- prefer_function_declarations_over_variables
- unnecessary_lambdas
- prefer_equal_for_default_values
- avoid_init_to_null
- unnecessary_getters_setters
#- unnecessary_getters # prefer # Disabled pending fix: https://github.com/dart-lang/linter/issues/23
#- prefer_expression_function_bodies # consider
- unnecessary_this
- prefer_initializing_formals
- type_init_formals
- empty_constructor_bodies
- unnecessary_new
- prefer_const_constructors
- avoid_catches_without_on_clauses # avoid
- use_rethrow_when_possible

# DESIGN
- use_to_and_as_if_applicable # prefer
- one_member_abstracts # avoid
- avoid_classes_with_only_static_members # avoid
- prefer_final_fields # prefer
- use_setters_to_change_properties
- avoid_setters_without_getters
- avoid_returning_null # avoid
- avoid_returning_this # avoid
- type_annotate_public_apis # prefer
#- prefer_typing_uninitialized_variables # consider
- omit_local_variable_types # avoid
- avoid_return_types_on_setters
- prefer_generic_function_type_aliases
- avoid_private_typedef_functions # prefer
#- use_function_type_syntax_for_parameters # consider
- avoid_positional_boolean_parameters # avoid
- hash_and_equals
- avoid_null_checks_in_equality_operators
include: package:flutter_lints/flutter.yaml
10 changes: 5 additions & 5 deletions packages/youtube_player_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## 8.1.3
* Bumped `flutter_inappwebview` to stable version 6.0.0.
## 9.0.0
* Bumps `flutter_inappwebview` to latest version.

## 8.1.2
* Bumped `flutter_inappwebview` to latest version.
* Added support for extracting video id from YouTube Shorts & Music URL.
* Bumps `flutter_inappwebview` to latest version.
* Adds support for extracting video id from YouTube Shorts & Music URL.

## 8.1.1
* Bumped `flutter_inappwebview` to latest version.
* Bumps `flutter_inappwebview` to latest version.
* Fixed cast error in YouTube error.

## 8.1.0
Expand Down
39 changes: 37 additions & 2 deletions packages/youtube_player_flutter/example/.metadata
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
# This file should be version controlled.

version:
revision: f7a6a7906be96d2288f5d63a5a54c515a6e987fe
revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: android
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: ios
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: linux
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: macos
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: web
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: windows
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package np.com.sarbagyastha.youtube_player_flutter_example

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -208,10 +208,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down Expand Up @@ -244,6 +246,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
2 changes: 2 additions & 0 deletions packages/youtube_player_flutter/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Flutter
import UIKit
import XCTest

class RunnerTests: XCTestCase {

func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}

}
1 change: 1 addition & 0 deletions packages/youtube_player_flutter/example/linux/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flutter/ephemeral
Loading

0 comments on commit 09a6ec4

Please sign in to comment.