Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

Commit

Permalink
Version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarbagya committed Feb 2, 2019
1 parent 3b4ace6 commit 8c804ab
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 40 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.0.0] - February 1, 2019.

* **Breaking change**. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to [also migrate](https://developer.android.com/jetpack/androidx/migrate) if they're
using the original support library.
* AutoPlay property added.

## [0.8.1] - January 29, 2019.

* Minor bug fixes.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Youtube Player Plugin

[![pub package](https://img.shields.io/badge/pub-v0.8.1-brightgreen.svg)](https://pub.dartlang.org/packages/youtube_player)
[![pub package](https://img.shields.io/badge/pub-v1.0.1-brightgreen.svg)](https://pub.dartlang.org/packages/youtube_player)

A flutter plugin to play Youtube Videos "inline" without API Key in ranges of Quality(240p, 360p, 480p, 720p and 1080p).

Expand All @@ -23,7 +23,7 @@ Add this to you package's `pubspec.yaml` file:

```yaml
dependencies:
youtube_player: ^0.8.1
youtube_player: ^1.0.1
```
#### 2\. Install
Expand Down Expand Up @@ -54,11 +54,13 @@ import 'package:youtube_player/youtube_player.dart';
/// "source" can be either youtube video ID or link.
/// "showThumbnail" Default is true.
/// "acpectRatio" Default is 16/9
/// "autoPlay" Default is true
///
YoutubePlayer(
source: "nPt8bK2gbaU",
quality: YoutubeQuality.HD,
aspectRatio: 16/9,
autoPlay: false,
showThumbnail: true,
// callbackController is (optional).
// use it to control player on your own.
Expand Down
8 changes: 0 additions & 8 deletions android/.idea/dictionaries/Sarbagya.xml

This file was deleted.

4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
compileSdkVersion 27
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
Expand Down
10 changes: 5 additions & 5 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 27
compileSdkVersion 28

lintOptions {
disable 'InvalidPackage'
Expand All @@ -35,10 +35,10 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "np.com.sarbagyastha.youtubeplayerexample"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand All @@ -56,6 +56,6 @@ flutter {

dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
2 changes: 2 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
19 changes: 12 additions & 7 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MyApp extends StatelessWidget {
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.pink,
primarySwatch: Colors.red,
),
home: MyHomePage(title: 'Youtube Player Demo'),
);
Expand Down Expand Up @@ -52,6 +52,7 @@ class _MyHomePageState extends State<MyHomePage> {
YoutubePlayer(
source: id,
quality: YoutubeQuality.HD,
autoPlay: true,
callbackController: (controller) {
_controller = controller;
},
Expand Down Expand Up @@ -83,7 +84,7 @@ class _MyHomePageState extends State<MyHomePage> {
padding: EdgeInsets.symmetric(
vertical: 16.0,
),
color: Colors.pink,
color: Colors.red,
child: Text(
"PLAY",
style: TextStyle(fontSize: 18.0, color: Colors.white),
Expand All @@ -99,7 +100,10 @@ class _MyHomePageState extends State<MyHomePage> {
children: <Widget>[
IconButton(
icon: Icon(Icons.play_arrow),
onPressed: () => _controller.videoPlayerController.value.isPlaying? null : _controller.play()),
onPressed: () => _controller
.videoPlayerController.value.isPlaying
? null
: _controller.play()),
IconButton(
icon: Icon(Icons.pause),
onPressed: () => _controller.pause()),
Expand Down Expand Up @@ -140,7 +144,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: OutlineButton(
child: Text("Adjust"),
onPressed: () => _controller.setVolume(
double.parse(_volumeController.text) * 10)),
double.parse(_volumeController.text) / 10)),
),
),
),
Expand All @@ -159,9 +163,10 @@ class _MyHomePageState extends State<MyHomePage> {
child: Text(videoDuration),
onPressed: () {
setState(() {
videoDuration = _controller
.videoPlayerController.value.duration.inSeconds
.toString() +" seconds";
videoDuration = _controller.videoPlayerController
.value.duration.inSeconds
.toString() +
" seconds";
});
}),
OutlineButton(
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
19 changes: 9 additions & 10 deletions lib/youtube_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
dataSourceDescription,
);
_textureId = response['textureId'];
if(!_creatingCompleter.isCompleted){
if (!_creatingCompleter.isCompleted) {
_creatingCompleter.complete(null);
}
final Completer<void> initializingCompleter = Completer<void>();
Expand Down Expand Up @@ -717,31 +717,31 @@ class YoutubePlayer extends StatefulWidget {
final Color handleColor;
final Color controlsColor;
final Color controlsBackgroundColor;
final Widget placeHolder;
final Duration startAt;
final bool showThumbnail;
final bool keepScreenOn;
final bool autoInitialize;
final bool showControls;
final bool fullScreen;
final bool autoPlay;
final YPCallBack callbackController;

YoutubePlayer(
{@required this.source,
@required this.quality,
this.aspectRatio = 16 / 9,
this.bufferedColor = Colors.white,
this.playedColor = Colors.pink,
this.handleColor = Colors.pink,
this.playedColor = Colors.red,
this.handleColor = Colors.red,
this.controlsColor = Colors.white,
this.controlsBackgroundColor = const Color(0x33000000),
this.placeHolder,
this.startAt,
this.showThumbnail = true,
this.keepScreenOn = true,
this.autoInitialize = true,
this.showControls = true,
this.fullScreen = false,
this.autoPlay = true,
this.callbackController});

@override
Expand Down Expand Up @@ -777,11 +777,11 @@ class _YoutubePlayerState extends State<YoutubePlayer> {
super.dispose();
}

void initializeYTController(){
void initializeYTController() {
_youtubePlayerControllerController = YoutubePlayerController(
videoPlayerController: _videoController,
aspectRatio: widget.aspectRatio,
autoPlay: true,
autoPlay: widget.autoPlay,
startAt: widget.startAt,
allowedScreenSleep: !widget.keepScreenOn,
autoInitialize: widget.autoInitialize,
Expand All @@ -792,9 +792,8 @@ class _YoutubePlayerState extends State<YoutubePlayer> {
playedColor: widget.playedColor,
handleColor: widget.handleColor,
),
placeholder: widget.placeHolder,
);
if(widget.callbackController!=null){
if (widget.callbackController != null) {
widget.callbackController(_youtubePlayerControllerController);
}
print("Youtube Video Id: $videoId");
Expand All @@ -819,7 +818,7 @@ class _YoutubePlayerState extends State<YoutubePlayer> {
initializeYTController();
}
}
if(initialize){
if (initialize) {
initializeYTController();
initialize = false;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: youtube_player
description: A flutter plugin to play Youtube Videos "inline" without API Key in range of Quality(240p, 360p, 480p, 720p and 1080p).
version: 0.8.1
version: 1.0.1
author: Sarbagya Dhaubanjar <mail@sarbagyastha.com.np>
homepage: https://github.com/sarbagyastha/youtube_player

Expand Down
16 changes: 12 additions & 4 deletions youtube_player.iml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<module external.linked.project.id="youtube_player" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
Expand Down

0 comments on commit 8c804ab

Please sign in to comment.