├── .gitignore
├── .idea
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── takusemba
│ │ └── rtmpplayer
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── takusemba
│ │ │ └── rtmpplayer
│ │ │ └── MainActivity.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── takusemba
│ └── rtmpplayer
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RtmpPlayer
2 |
3 | set your RTMP url in local.properties
4 |
5 | ```local.properties
6 | ## This file is automatically generated by Android Studio.
7 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
8 | #
9 | # This file must *NOT* be checked into Version Control Systems,
10 | # as it contains information specific to your local configuration.
11 | #
12 | # Location of the SDK. This is only used by Gradle.
13 | # For customization when using a Version Control System, please read the
14 | # header note.
15 | #Sat Feb 03 15:58:12 JST 2018
16 | ndk.dir=/Users/takusemba/Library/Android/sdk/ndk-bundle
17 | sdk.dir=/Users/takusemba/Library/Android/sdk
18 |
19 | streaming_url = your rtmp url
20 | ```
21 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 |
4 |
5 | android {
6 | compileSdkVersion 26
7 | defaultConfig {
8 | applicationId "com.takusemba.rtmpplayer"
9 | minSdkVersion 15
10 | targetSdkVersion 26
11 | versionCode 1
12 | versionName "1.0"
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 | buildConfigField "String", "STREAMING_URL", "\"" + getStreamingUrl() + "\""
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | implementation fileTree(dir: 'libs', include: ['*.jar'])
26 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
27 | implementation 'com.android.support:appcompat-v7:26.1.0'
28 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
29 | testImplementation 'junit:junit:4.12'
30 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
31 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
32 |
33 | implementation 'com.google.android.exoplayer:exoplayer-core:2.6.0'
34 | implementation 'com.google.android.exoplayer:exoplayer-ui:2.6.0'
35 | compile 'com.google.android.exoplayer:extension-rtmp:2.6.0'
36 |
37 | }
38 |
39 | def getStreamingUrl() {
40 | Properties properties = new Properties()
41 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
42 | return properties.getProperty("streaming_url")
43 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/takusemba/rtmpplayer/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.takusemba.rtmpplayer
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.takusemba.rtmpplayer", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/takusemba/rtmpplayer/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.takusemba.rtmpplayer
2 |
3 | import android.net.Uri
4 | import android.os.Bundle
5 | import android.support.v7.app.AppCompatActivity
6 | import android.widget.Button
7 | import com.google.android.exoplayer2.DefaultLoadControl
8 | import com.google.android.exoplayer2.DefaultRenderersFactory
9 | import com.google.android.exoplayer2.ExoPlayerFactory
10 | import com.google.android.exoplayer2.SimpleExoPlayer
11 | import com.google.android.exoplayer2.ext.rtmp.RtmpDataSourceFactory
12 | import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory
13 | import com.google.android.exoplayer2.source.ExtractorMediaSource
14 | import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
15 | import com.google.android.exoplayer2.ui.SimpleExoPlayerView
16 |
17 | class MainActivity : AppCompatActivity() {
18 |
19 | private var player: SimpleExoPlayer? = null
20 |
21 | override fun onCreate(savedInstanceState: Bundle?) {
22 | super.onCreate(savedInstanceState)
23 | setContentView(R.layout.activity_main)
24 |
25 | play()
26 |
27 | findViewById