Create Cronet extension in v2
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=131393395
This commit is contained in:
parent
b53fa245ce
commit
4df63314d4
31
extensions/cronet/README.md
Normal file
31
extensions/cronet/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# ExoPlayer Cronet Extension #
|
||||
|
||||
## Description ##
|
||||
|
||||
[Cronet][] is Chromium's Networking stack packaged as a library.
|
||||
|
||||
The Cronet Extension is an [HttpDataSource][] implementation using [Cronet][].
|
||||
|
||||
[HttpDataSource]: https://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer/upstream/HttpDataSource.html
|
||||
[Cronet]: https://chromium.googlesource.com/chromium/src/+/master/components/cronet?autodive=0%2F%2F
|
||||
|
||||
## Build Instructions ##
|
||||
|
||||
* Checkout ExoPlayer along with Extensions:
|
||||
|
||||
```
|
||||
git clone https://github.com/google/ExoPlayer.git
|
||||
```
|
||||
|
||||
* Get the Cronet libraries:
|
||||
|
||||
1. Find the latest Cronet release [here][] and navigate to its `Release/cronet`
|
||||
directory
|
||||
1. Download `cronet.jar`, `cronet_api.jar` and the `libs` directory
|
||||
1. Copy the two jar files into the `libs` directory of this extension
|
||||
1. Copy the content of the downloaded `libs` directory into the `jniLibs`
|
||||
directory of this extension
|
||||
|
||||
* In ExoPlayer's `settings.gradle` file, uncomment the Cronet extension
|
||||
|
||||
[here]: https://console.cloud.google.com/storage/browser/chromium-cronet/android
|
51
extensions/cronet/build.gradle
Normal file
51
extensions/cronet/build.gradle
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright (C) 2014 The Android Open Source Project
|
||||
//
|
||||
// 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.
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 23
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
jniLibs.srcDirs = ['jniLibs']
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':library')
|
||||
compile files('libs/cronet_api.jar')
|
||||
compile files('libs/cronet.jar')
|
||||
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
|
||||
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
|
||||
androidTestCompile 'org.mockito:mockito-core:1.9.5'
|
||||
androidTestCompile project(':library')
|
||||
androidTestCompile 'com.android.support.test:runner:0.4'
|
||||
}
|
1
extensions/cronet/jniLibs/README.md
Normal file
1
extensions/cronet/jniLibs/README.md
Normal file
@ -0,0 +1 @@
|
||||
Copy folders containing architecture specific .so files here.
|
1
extensions/cronet/libs/README.md
Normal file
1
extensions/cronet/libs/README.md
Normal file
@ -0,0 +1 @@
|
||||
Copy cronet.jar and cronet_api.jar here.
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.google.android.exoplayer2.util;
|
||||
|
||||
/**
|
||||
* An interface through which system clocks can be read. The {@link SystemClock} implementation
|
||||
* must be used for all non-test cases.
|
||||
*/
|
||||
public interface Clock {
|
||||
|
||||
/**
|
||||
* Returns {@link android.os.SystemClock#elapsedRealtime}.
|
||||
*
|
||||
* @return Elapsed milliseconds since boot.
|
||||
*/
|
||||
long elapsedRealtime();
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.google.android.exoplayer2.util;
|
||||
|
||||
/**
|
||||
* The standard implementation of {@link Clock}.
|
||||
*/
|
||||
public final class SystemClock implements Clock {
|
||||
|
||||
@Override
|
||||
public long elapsedRealtime() {
|
||||
return android.os.SystemClock.elapsedRealtime();
|
||||
}
|
||||
|
||||
}
|
@ -20,10 +20,15 @@ include ':extension-vp9'
|
||||
include ':extension-okhttp'
|
||||
include ':extension-flac'
|
||||
include ':extension-ffmpeg'
|
||||
// Uncomment the following line to use the Cronet Extension.
|
||||
// include ':extension-cronet'
|
||||
|
||||
|
||||
project(':extension-opus').projectDir = new File(settingsDir, 'extensions/opus')
|
||||
project(':extension-vp9').projectDir = new File(settingsDir, 'extensions/vp9')
|
||||
project(':extension-okhttp').projectDir = new File(settingsDir, 'extensions/okhttp')
|
||||
project(':extension-flac').projectDir = new File(settingsDir, 'extensions/flac')
|
||||
project(':extension-ffmpeg').projectDir = new File(settingsDir, 'extensions/ffmpeg')
|
||||
|
||||
// Uncomment the following line to use the Cronet Extension.
|
||||
// See extensions/cronet/README.md for details.
|
||||
// project(':extension-cronet').projectDir = new File(settingsDir, 'extensions/cronet')
|
||||
|
Loading…
x
Reference in New Issue
Block a user