|
1 year ago | |
---|---|---|
app | 1 year ago | |
gradle/wrapper | 2 years ago | |
ui | 2 years ago | |
.gitignore | 3 years ago | |
README.md | 1 year ago | |
build.gradle | 1 year ago | |
gradle.properties | 2 years ago | |
gradlew | 3 years ago | |
gradlew.bat | 3 years ago | |
settings.gradle | 3 years ago |
The v3 is all new SDK with features including podcast playback, multiple media list playback, memory optimization, optimized events handling, faster media playback, media and ad pre-caching, optional UI, PIP etc. The v3 player is optimized for multiple media handling especially for playback in listing.
[TOC]
The v3 player SDK consists 2 types of players. SlikePlayer2 and SlikePlayer3.
The SlikePlayer3 is a service based player can be played in background. The player is independent of UI lifecycle. The player can be used for podcast or view independent media playback. The can play all types of media excluding YouTube, DailyMotion, Gify and Meme. The player can play ad. The UI is optional.
The SlikePlayer2 is lifecycle dependent player. The player is fragment based player and can play all supported media. The player has inbuilt ad support system.
The event structure is as follows.
For reference please clone the demo link as follows.
https://code.slike.in/android/v3demo.git
Current v3core is 6.3.0
Current slikeversion is 5.0.0
Add following lines in allProjects -> repositories.
buildscript {
ext.kotlin_version = '1.5.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.24.22"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'http://vsnl.slike.in/jenkins/artifactory/slikerepo/' }
}
}
ext {
minSdkVersion = 19
targetSdkVersion = 30
compileSdkVersion = 30
buildToolsVersion = '30.0.1'
versionCode = 95
versionName = '5.0.0'
appcompatVersion = '1.3.1'
runtimeVersion = '2.6.0'
concurrentVersion = '1.1.0'
volleyVersion = '1.2.1'
analyticsVersion = '17.0.1'
v3core = '6.3.0'
commoncore = '2.0'
imaSDK = '3.25.1'
fanSDK = '5.6.1'
comscore = '5.+'
picasso = '2.71828'
exoVersion = '2.14.2'
minifyEnabled = false
shrinkResources = false
}
Add following lines in gradle dependency
implementation "androidx.concurrent:concurrent-futures:$rootProject.concurrentVersion"
implementation "androidx.work:work-runtime:$rootProject.runtimeVersion"
implementation "com.android.volley:volley:$rootProject.volleyVersion"
implementation "androidx.work:work-runtime:$rootProject.runtimeVersion"
implementation "in.slike.player.v3core:v3core:$v3core"
implementation "in.slike.player.v3:ui:$slikeversion"
implementation "in.slike.player.v3:player:$slikeversion"
implementation "in.slike.player.commoncore:commoncore:$commoncore"
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
implementation "androidx.core:core-ktx:1.6.0"
implementation "com.google.android.exoplayer:exoplayer-core:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:exoplayer-hls:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:exoplayer-dash:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:extension-ima:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:extension-mediasession:$rootProject.exoVersion"
implementation "com.google.android.gms:play-services-analytics:$rootProject.analyticsVersion"
compileOnly 'org.checkerframework:checker-qual:3.5.1'
implementation 'androidx.media:media:1.4.3'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'org.jetbrains:annotations:16.0.1'
Initialize config on time somewhere in either splash or in application onCreate.
public void init(@NonNull String apiKey, boolean isGDPREnabled, boolean enableDebug, @Nullable IConfigListener listener)
Initialize player. Create a [MediaConfig](# MediaConfig) object.
If podcast or without UI player (SlikePlayer3) need to be initialise, use following method.
public static void playMedia(@Nullable RenderingObjects renderingObjects, @NonNull MediaConfig[] configs, @NonNull Pair<Integer, Long> position, @Nullable IMediaStatus mediaStatus);
eg.
SlikePlayer3.playMedia(null, configs, new Pair<>(position, 0L), AudioMiniPlayer.this);
If normal player (SlikePlaer2) is initialized.
public void playMedia(final MediaConfig config, RenderingObjects renderingObjects, Pair<Integer, Long> position, IMediaStatus mediaStatus);
eg.
SlikePlayer2.get().playMedia(mediaConfig, renderingObjects, new Pair<>(0, 0L), this);
In v3 player, playercontrol is not part of the SDK in this release. We are separately providing source code of control to modify the UI as per need.
The SDK can play many type of videos and has many third-party players like YouTube, DailyMotion, Facebook etc. All other players gives their own controls.
So, first check in K.MEDIA_PLAYER_DECIDED status to detect player type. Rest of the snippet as follows.
@Override
public void onStatus(@K.PlayerState int state, Status status){
if (state == K.MEDIA_PLAYER_DECIDED){
isTP = SlikePlayer2.get().getPlayerType() != K.PLAYER_EXO;
...
}
...
if(!isTP){
control.onStatus(status);
if(gestureControl != null) gestureControl.onStatus(status);
}
}
@Override
public void onAdStatus(AdsStatus status) {
if (status == null) return;
...
if (!isTP) {
control.onAdStatus(status);
if (gestureControl != null) gestureControl.onAdStatus(status);
}
}
@Override
public void onError(SAException err) {
errorView.setText(err.getMessage());
errorView.setVisibility(View.VISIBLE);
control.onError(err);
if (gestureControl != null) gestureControl.onError(err);
...
}
Note: Refer to PlayerView in UI module regarding control implementation.
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.google.firebase:firebase-analytics:20.0.0'
implementation "com.google.ads.interactivemedia.v3:interactivemedia:$rootProject.imaSDK"
implementation 'com.google.android.gms:play-services-ads:20.0.0'
implementation "androidx.appcompat:appcompat:$rootProject.appcompatVersion"
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation "androidx.concurrent:concurrent-futures:$rootProject.concurrentVersion"
implementation "androidx.work:work-runtime:$rootProject.runtimeVersion"
implementation "com.android.volley:volley:$rootProject.volleyVersion"
implementation "androidx.work:work-runtime:$rootProject.runtimeVersion"
implementation "in.slike.player.v3core:v3core:$v3core"
implementation "in.slike.player.v3:player:$slikeversion"
implementation "com.squareup.picasso:picasso:$rootProject.picasso"
implementation 'com.android.support:multidex:1.0.3'
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.5.0-alpha02'
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "com.google.android.exoplayer:exoplayer-core:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:exoplayer-hls:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:exoplayer-dash:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:extension-ima:$rootProject.exoVersion"
implementation "com.google.android.exoplayer:extension-mediasession:$rootProject.exoVersion"
implementation "com.google.android.gms:play-services-analytics:$rootProject.analyticsVersion"
compileOnly 'org.checkerframework:checker-qual:3.5.0'
implementation 'androidx.media:media:1.4.3'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'org.jetbrains:annotations:16.0.1'
implementation project(path: ':ui')
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
implementation "androidx.core:core-ktx:1.6.0"
implementation "in.slike.player.commoncore:commoncore:$commoncore"
}
Property or method name | Type | Default value | Description |
---|---|---|---|
MediaConfig(@NonNull String slikeID) | Constructor | ||
MediaConfig( @NonNull String slikeID, @[K.VideoSourceType](# VideoSourceType) int sourceType) |
Constructor | ||
setSlikeID(@NonNull String slikeID) | Method | ||
setTPID(String TPID, @[K.VideoSourceType](# VideoSourceType) int sourceType) |
Method. The TPID could be a valid URL or related media id. | ||
setTitle(String title) | Method | ||
setSeotitle(String seotitle) | Method. The SEO title is English only text pass for ad monetisation. This is mandatory if language is other than english |
||
setDesc(String desc) | Method | ||
setPoster(Object poster) | The poster can be String or Bitmap | ||
setThumb(Object thumb) | The thumb can be String or Bitmap |
Property or method name | Type | Default value | Description |
---|---|---|---|
setAutoPlay(boolean autoPlay) | boolean | true | Auto play media |
autoPlayList | boolean | true | Auto play media playlist |
autoRepeat | boolean | false | Auto repeat media |
autoRepeatList | boolean | false | Auto repeat media playlist |
shuffleMode | boolean | false | Shuffle the playlist |
retainCurrentMedia | boolean | true | Continue playing current media if exists in the new playlist |
setPlayerVolume(int playerVolume) | Current system volume |
Player volume. 0 >= vol <= 100 | |
All constants are defined in the class K (in.slike.player.v3core.K).
Bitrate control constants.
Name | Description |
---|---|
AUTO_BITRATE | Auto bitrate adjustment |
LOW_BITRATE | Low bitrates bucket only |
MEDIUM_BITRATE | Medium bitrates bucket only |
HIGH_BITRATE | High bitrates bucket only |
Playback speed control constants.
Name | Description |
---|---|
SLOWSPEED | Playback speed 0.5X |
NORMALSPEED | Normal playback speed |
SPEED | Playback speed 1.5X |
HIGHSPEED | Playback speed 2.0X |
VERYHIGHSPEED | Playback speed 2.5X |
ULTRAHIGHSPEED | Playback speed 3.0X |
Defines playback criticality. The playback criticality can be lazy loading in case or normal playback or critical in case of live events with cue points.
Name | Description |
---|---|
OFF_MODE | Use default criticality. Optimized burden on resources |
LAZY_LOADING_MODE | Lesser burden on resources |
CRITICAL_MODE | Consume more resources to meet criticality |
Defines how errors can be handled.
Name | Description |
---|---|
SAFE_ONLY | The player handles all safe errors itself |
SAFE_NETWORK | Handles safe errors including network related errors |
ALL_ERRORS | Handle all errors itself and no error will be thrown out |
Some of the supported video types. In case of slikeid, player itself handles optimized source type.
Name | Description |
---|---|
VIDEO_SOURCE_YT | Youtube video |
VIDEO_SOURCE_DASH | Mpeg dash video |
VIDEO_SOURCE_HLS | HLS video |
VIDEO_SOURCE_MP4 | MP4 video |
VIDEO_SOURCE_MP3 | MP3 audio |
VIDEO_SOURCE_FB | Facebook video |
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.
Times Internet Limited 2020