Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to androidx and added screenshot method #236

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: https://paypal.me/janrabe/5
26 changes: 26 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Android CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
[![CI Status](https://api.travis-ci.org/kaltura/MD360Player4Android.svg?branch=develop)](https://travis-ci.com/github/kaltura/MD360Player4Android)
[![Download](https://img.shields.io/maven-central/v/com.kaltura.playkit/md360player?label=Download)](https://search.maven.org/artifact/com.kaltura.playkit/md360player)
[![License](https://img.shields.io/badge/license-AGPLv3-black.svg)](https://github.com/kaltura/playkit-android/blob/master/LICENSE)
![Android](https://img.shields.io/badge/platform-android-green.svg)
# MD360Player4Android [![Android CI](https://github.com/kibotu/MD360Player4Android/actions/workflows/android.yml/badge.svg)](https://github.com/kibotu/MD360Player4Android/actions/workflows/android.yml) [![](https://jitpack.io/v/kibotu/MD360Player4Android.svg)](https://jitpack.io/#kibotu/MD360Player4Android) [![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21) [![Gradle Version](https://img.shields.io/badge/gradle-8.11.1-green.svg)](https://docs.gradle.org/current/release-notes) [![Kotlin](https://img.shields.io/badge/kotlin-2.1.0-green.svg)](https://kotlinlang.org/)

# MD360Player4Android
It is a lite library to render 360 degree panorama video for Android.

[![](https://jitpack.io/v/ashqal/MD360Player4Android.svg)](https://jitpack.io/#ashqal/MD360Player4Android)

## Preview
Expand All @@ -21,24 +18,23 @@ It is a lite library to render 360 degree panorama video for Android.
* [Working with vlc](https://github.com/ashqal/MD-vlc-sample)

## Gradle
```java
allprojects {
```groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
...
maven { url "https://jitpack.io" }
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```
```java
dependencies {
compile 'com.github.ashqal:MD360Player4Android:2.5.0'
implementation 'com.github.kibotu:NumberProgressBar:Tag'
}
```

## USAGE
### Using with GLSurfaceView
**STEP1** Define `GLSurfaceView` in the layout xml.
```java
```xml
<android.opengl.GLSurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
Expand Down
119 changes: 100 additions & 19 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,117 @@
ext {
versionName = VERSION_NAME
VERSION_CODE = 1
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31

namespace "com.asha.md360player4android"
compileSdk compileSdkVer
buildToolsVersion = buildToolsVer

defaultConfig {
applicationId "com.asha.md360player4android"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
minSdk minSdkVer
targetSdk targetSdkVer
multiDexEnabled true
versionCode VERSION_CODE
versionName VERSION_NAME
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
debug {
pseudoLocalesEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
shrinkResources = false
}
release {
minifyEnabled true
shrinkResources = true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

tasks.withType(Javadoc) {
options.addBooleanOption('Xdoclint:none', true)
buildFeatures {
viewBinding true
}

// region java compile options

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

compileOptions {
coreLibraryDesugaringEnabled true

sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

// endregion

// region kotlin compile options

kotlinOptions {
jvmTarget = "17"
allWarningsAsErrors = false
kotlinOptions.verbose = true

//## Hint: https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#default-methods-in-interfaces
//## Hint: "-Xjvm-default=all-compatibility" and "-Xjvm-default=all-compatibility" will also work.
freeCompilerArgs += [
"-Xjvm-default=all-compatibility",
// disable linting for opt-in annotations
"-opt-in=kotlin.RequiresOptIn"
]
}

// endregion

// region lint options

lint {
disable 'TypographyFractions', 'TypographyQuotes', 'InvalidPackage'
enable 'RtlHardcoded', 'RtlCompat', 'RtlEnabled'
checkOnly 'NewApi', 'InlinedApi'
quiet true
abortOnError false
ignoreWarnings true
checkDependencies true
ignoreTestSources true
checkAllWarnings false
}

// endregion

// region exclude duplicated meta inf files

packagingOptions {
// DebugProbesKt.bin is used for java debugging (not needed for android)
// Hint: https://github.com/Kotlin/kotlinx.coroutines/issues/2274
exclude 'DebugProbesKt.bin'

// https://stackoverflow.com/a/61893957/1006741
excludes -= "/META-INF/*.kotlin_module"
}

// endregion
}

dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
//required, enough for most devices.
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.6.0'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.6.0'
coreLibraryDesugaring desugaring.jdk
implementation libs.supportAppCompat
implementation libs.material
implementation libs.picasso
implementation libs.recyclerview
implementation libs.cardview
implementation project(path: ':vrlib')
}
27 changes: 12 additions & 15 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/Asha/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:
# https://raw.githubusercontent.com/square/okhttp/master/okhttp/src/main/resources/META-INF/proguard/okhttp3.pro
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

This file was deleted.

49 changes: 38 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asha.md360player4android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".DemoActivity" android:configChanges="screenSize|orientation" android:screenOrientation="landscape">
<activity
android:name=".DemoActivity"
android:configChanges="screenSize|orientation"
android:exported="true"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="IjkPlayerDemoActivity" android:name=".IjkPlayerDemoActivity" android:screenOrientation="landscape" android:configChanges="screenSize|orientation" />
<activity android:label="VideoPlayerActivity" android:name=".VideoPlayerActivity" android:screenOrientation="landscape" android:configChanges="screenSize|orientation" />
<activity android:label="BitmapPlayerActivity" android:name=".BitmapPlayerActivity" android:screenOrientation="landscape" android:configChanges="screenSize|orientation" />
<activity android:label="CubemapPlayerActivity" android:name=".CubemapPlayerActivity" android:screenOrientation="landscape" android:configChanges="screenSize|orientation" />
<activity android:name=".RecyclerViewActivity" android:screenOrientation="portrait" android:configChanges="screenSize|orientation" />
<activity
android:name=".IjkPlayerDemoActivity"
android:configChanges="screenSize|orientation"
android:exported="false"
android:label="IjkPlayerDemoActivity"
android:screenOrientation="landscape" />
<activity
android:name=".VideoPlayerActivity"
android:configChanges="screenSize|orientation"
android:exported="false"
android:label="VideoPlayerActivity"
android:screenOrientation="landscape" />
<activity
android:name=".BitmapPlayerActivity"
android:configChanges="screenSize|orientation"
android:exported="false"
android:label="BitmapPlayerActivity"
android:screenOrientation="landscape" />
<activity
android:name=".CubemapPlayerActivity"
android:configChanges="screenSize|orientation"
android:exported="false"
android:label="CubemapPlayerActivity"
android:screenOrientation="landscape" />
<activity
android:name=".RecyclerViewActivity"
android:configChanges="screenSize|orientation"
android:exported="false"
android:screenOrientation="portrait" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
}

@Override
public void onBitmapFailed(Drawable errorDrawable) {
public void onBitmapFailed(Exception e, Drawable errorDrawable) {

}

Expand All @@ -72,7 +72,7 @@ public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
Log.d(TAG, "load image with max texture size:" + callback.getMaxTextureSize());
Picasso.with(getApplicationContext())
Picasso.get()
.load(uri)
.resize(callback.getMaxTextureSize(),callback.getMaxTextureSize())
.onlyScaleDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
}

@Override
public void onBitmapFailed(Drawable errorDrawable) {
public void onBitmapFailed(Exception e, Drawable errorDrawable) {

}

Expand All @@ -75,7 +75,7 @@ public void onPrepareLoad(Drawable placeHolderDrawable) {
};

Log.d(TAG, "load image with max texture size:" + callback.getMaxTextureSize());
Picasso.with(getApplicationContext())
Picasso.get()
.load(uri)
.resize(callback.getMaxTextureSize(),callback.getMaxTextureSize())
.onlyScaleDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ public class CustomProjectionFactory implements IMDProjectionFactory {

@Override
public AbsProjectionStrategy createStrategy(int mode) {
switch (mode){
switch (mode) {
case CUSTOM_PROJECTION_FISH_EYE_RADIUS_VERTICAL:
return new MultiFishEyeProjection(0.745f, MDDirection.VERTICAL);
default:return null;
default:
return null;
}
}
}
Loading