Easy to use floating Youtube Video Library
More features will be added in upcoming days
Picture in picture has become popular these days. Unfortunately Android brought this support to Android 8.0 (API level 26) and later versions. Pip and floating video supported apps offer users the ability to easily view other features while watching videos (Like reading comments etc). With this library you can play youtube videos in a floating panel.
view
can be any Button, Imageview or ImageButton which activate the FlyingVideo. videoId
should have an ID of your YouTube video. For simply:
FlyingVideo.get(MainActivity.this)
.setFloatMode(TaskCoffeeVideo.FLOAT_MOVE.STICKY)
.setVideoStartSecond((mTracker == null) ? 0 : mTracker.getCurrentSecond())
.coffeeVideoSetup(videoId)
.show(view);
FlyingVideo automatically snaps up or down according to the position of the screen where you left the panel.
FlyingVideo.get(MainActivity.this)
.setFloatMode(TaskCoffeeVideo.FLOAT_MOVE.STICKY)
.setVideoStartSecond((mTracker == null) ? 0 : mTracker.getCurrentSecond())
.coffeeVideoSetup(videoId)
.show(view);
FlyingVideo never sticks on constant position, it stays on the position where you left.
FlyingVideo.get(MainActivity.this)
.setFloatMode(TaskCoffeeVideo.FLOAT_MOVE.FREE)
.setVideoStartSecond((mTracker == null) ? 0 : mTracker.getCurrentSecond())
.coffeeVideoSetup(videoId)
.show(view);
FlyVideo appears bottom of the screen when opened.
FlyingVideo.get(MainActivity.this)
.setFloatMode(TaskCoffeeVideo.FLOAT_MOVE.FREE)
.setVideoStartSecond((mTracker == null) ? 0 : mTracker.getCurrentSecond())
.coffeeVideoSetup(videoId)
.setFlyGravity(TaskCoffeeVideo.FLY_GRAVITY.BOTTOM)
.show(view);
FlyVideo appears top of the screen when opened.
FlyingVideo.get(MainActivity.this)
.setFloatMode(TaskCoffeeVideo.FLOAT_MOVE.FREE)
.setVideoStartSecond((mTracker == null) ? 0 : mTracker.getCurrentSecond())
.coffeeVideoSetup(videoId)
.setFlyGravity(TaskCoffeeVideo.FLY_GRAVITY.TOP)
.show(view);
13.07.2020 AndroidX Migration
FullScreen Support Added
Users who are already using do not need to make any changes. Users who want to use full screen feature should get YoutubeApi key. Users without YouTube or devices without PlayStore support are directed to webview for full screen mode.
setFullScreenToggleEnabled(true, "-YOUR-YOUTUBE-API-KEY-")
FlyingVideo.get(MainActivity.this)
.setFloatMode(TaskCoffeeVideo.FLOAT_MOVE.FREE)
.setFullScreenToggleEnabled(true, "-YOUR-YOUTUBE-API-KEY-")
.setVideoStartSecond((mTracker == null) ? 0 : mTracker.getCurrentSecond())
.coffeeVideoSetup(videoId)
.setFlyGravity(TaskCoffeeVideo.FLY_GRAVITY.BOTTOM)
.show(view);
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.AsynctaskCoffee:YoutubeFloatingVideo:0.0.5'
}
- Henning Dodenhof - Circular ImageView - hdodenhof
- Pierfrancesco Soffritti - android-youtube-player - PierfrancescoSoffritti
This library is designed not to violate the rules. However, all problems that may occur are under your responsibility.
Before publishing your app to GooglePlay please make sure that you have read Youtube and Google Terms;
Copyright 2020 Egemen ÖZOGUL
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.