fix android build

camera2
deathemperor 6 years ago
parent f5fcc76a52
commit 549f4bd30c

@ -2,7 +2,6 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig { defaultConfig {
applicationId "net.ossrs.yasea.demo" applicationId "net.ossrs.yasea.demo"
@ -23,8 +22,8 @@ android {
} }
dependencies { dependencies {
compile fileTree(dir: 'libx264.libs', include: ['*.jar']) implementation fileTree(dir: 'libx264.libs', include: ['*.jar'])
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0'
compile project(path: ':library') implementation project(path: ':library')
} }

@ -40,10 +40,11 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
private Button btnPause; private Button btnPause;
private SharedPreferences sp; private SharedPreferences sp;
private String rtmpUrl = "rtmp://ossrs.net/" + getRandomAlphaString(3) + '/' + getRandomAlphaDigitString(5); private String rtmpUrl = "rtmp://asia-southeast1-u-01-gw.uizadev.io:1935/push2transcode/918badeb-0c81-46f1-9e91-9a1cc566dc3a?token=28cc0b78538b13a120d1e47fc0c7ce85&ulasId=57ee741f-3daf-11e9-89c5-02c1b5b83c1a";
private String recPath = Environment.getExternalStorageDirectory().getPath() + "/test.mp4"; private String recPath = Environment.getExternalStorageDirectory().getPath() + "/test.mp4";
private SrsPublisher mPublisher; private SrsPublisher mPublisher;
private SrsCameraView mCameraView;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

@ -6,7 +6,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

@ -2,7 +2,6 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
@ -29,10 +28,10 @@ android {
} }
dependencies { dependencies {
compile fileTree(dir: 'libx264.libs', include: ['*.jar']) implementation fileTree(dir: 'libx264.libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })
compile 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0'
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }

@ -1,5 +1,6 @@
package net.ossrs.yasea; package net.ossrs.yasea;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.ImageFormat; import android.graphics.ImageFormat;
@ -9,6 +10,7 @@ import android.opengl.GLES20;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.opengl.Matrix; import android.opengl.Matrix;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.Surface;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter; import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterFactory; import com.seu.magicfilter.utils.MagicFilterFactory;
@ -373,7 +375,7 @@ public class SrsCameraView extends GLSurfaceView implements GLSurfaceView.Render
} }
protected Camera openCamera() { protected Camera openCamera() {
Camera camera; Camera camera = null;
if (mCamId < 0) { if (mCamId < 0) {
Camera.CameraInfo info = new Camera.CameraInfo(); Camera.CameraInfo info = new Camera.CameraInfo();
int numCameras = Camera.getNumberOfCameras(); int numCameras = Camera.getNumberOfCameras();

@ -1,5 +1,6 @@
package net.ossrs.yasea; package net.ossrs.yasea;
import android.hardware.Camera;
import android.media.AudioRecord; import android.media.AudioRecord;
import android.media.audiofx.AcousticEchoCanceler; import android.media.audiofx.AcousticEchoCanceler;
import android.media.audiofx.AutomaticGainControl; import android.media.audiofx.AutomaticGainControl;

Loading…
Cancel
Save