red5pro / streaming-android

This repository contains a simple project with a number of Android examples that can be used for testing and reference.
Other
85 stars 35 forks source link

red5pro jar file #67

Closed surabhi1694 closed 7 years ago

surabhi1694 commented 7 years ago

hey i'm using your git codeto understand thestreaming but it gives me error that red5pro-1.2.0 jar is not available i'm using android studio and noguat device please tell me if there is any comile lib to use red5pro or give me the solution.. please thank you

HoldenMills commented 7 years ago

Did you clone the repository, or download the project onto your local system?

Under build.gradle (Module: app), you will see the dependencies listed:

    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'ch.qos.logback:logback-classic:1.1.2'
 compile 'ch.qos.logback:logback-core:1.1.2'
 compile 'org.apache.mina:mina-core:2.0.7'
 compile 'org.slf4j:slf4j-api:1.7.5'
 compile 'com.android.support:support-v4:23.1.1'
 compile files('libs/red5pro-1.0.2.jar')
}

Please change the last line to ( 'libs/red5pro-1.2.0.jar' )

If that does not address your issue, please let me know.

notmark commented 7 years ago

I've tried both ways, libs/red5pro-1.2.0.jar doesn't exist and it won't build without it.

UPDATE: After reinstalling git I was able to clone and build the project after changing that line to red5pro-1.2.0.jar

UPDATE 2: Or maybe not. After a successful build I then tried to run the app and was presented with the following stack trace: `Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature. Incremental java compilation is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportSupportV42311Library :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest :app:processDebugResources :app:generateDebugSources :app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :app:javaPreCompileDebug :app:compileDebugJavaWithJavac :app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: D:...\streaming-android-master (1)\streaming-android\app\src\main\java\red5pro\org\testandroidproject\tests\SubscribeImageTest\SubscribeImageTest.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 1.651 secs `

HoldenMills commented 7 years ago

I tested this myself and was able to install the application without any modifications. What device are you using? The latest SDK version is 2.1.0 so I'm not sure what is going on here. What version of Android Studio are you using?

notmark commented 7 years ago

Yes, latest SDK 2.1.0 and using a fresh install of Android Studio 2.3 with an Android Virtual Device.

HoldenMills commented 7 years ago

Unfortunately, we do not support the use of virtual devices. You will have to use a physical device to test.

notmark commented 7 years ago

Okay. So I threw together a basic example using the link you gave, also included the lib and libraries from the sdk zip. I'm able to get a camera preview in the app, however I get an odd error when the app reaches publish.publish(streamName, R5Stream.RecordType.Live);

E/AndroidRuntime: FATAL EXCEPTION: Thread-71872

Process: vaughnsoft.marvin.deez4, PID: 26118

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/mina/core/buffer/IoBuffer;

at com.red5pro.streaming.core.l.a(Unknown Source)

at com.red5pro.streaming.R5Stream.write(Unknown Source)

at com.red5pro.streaming.source.c.run(Unknown Source)

at java.lang.Thread.run(Thread.java:818)

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.mina.core.buffer.IoBuffer" on path: DexPathList[[zip file "/data/app/vaughnsoft.marvin.deez4-2/base.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_dependencies_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_0_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_1_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_2_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_3_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_4_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_5_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_6_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_7_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_8_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/vaughnsoft.marvin.deez4-2/lib/arm, /data/app/vaughnsoft.marvin.deez4-2/base.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_8_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]

at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

at com.red5pro.streaming.core.l.a(Unknown Source)

at com.red5pro.streaming.R5Stream.write(Unknown Source)

at com.red5pro.streaming.source.c.run(Unknown Source)

at java.lang.Thread.run(Thread.java:818)

Suppressed: java.lang.ClassNotFoundException: org.apache.mina.core.buffer.IoBuffer

at java.lang.Class.classForName(Native Method)

at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

... 5 more

Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

Here is the code I'm using:

package vaughnsoft.marvin.deez4;

import android.app.Activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.hardware.Camera; import android.view.Surface;

import com.red5pro.streaming.R5Connection; import com.red5pro.streaming.R5Stream; import com.red5pro.streaming.R5StreamProtocol; import com.red5pro.streaming.config.R5Configuration; import com.red5pro.streaming.source.R5Camera; import com.red5pro.streaming.source.R5Microphone; import com.red5pro.streaming.view.R5VideoView;

public class MainActivity extends AppCompatActivity {

protected R5VideoView preview;
protected R5Stream publish;
protected Camera cam;
protected int camOrientation;

private static String serverHost = "198.255.17.18";
private static int serverPort = 8554;
private static String serverApp = "live";
private static Float serverBufferTime = 0.2f;

private static int videoWidth = 360;
private static int videoHeight = 640;
private static int videoBitrate = 750;

private static String streamName = "live_1234_zxcv";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    try {
        R5Configuration config = new

R5Configuration(R5StreamProtocol.RTSP, serverHost, serverPort, serverApp, serverBufferTime); R5Connection connection = new R5Connection(config); //setup a new stream using the connection publish = new R5Stream(connection); R5Camera camera = null; //attach a camera video source cam = openFrontFacingCameraGingerbread(); cam.setDisplayOrientation((camOrientation + 180) % 360);

        camera = new R5Camera(cam, videoWidth, videoHeight);
        camera.setBitrate(videoBitrate);
        camera.setOrientation(camOrientation);
        //attach a microphone
        R5Microphone mic = new R5Microphone();
        publish.attachMic(mic);

        preview = (R5VideoView) this.findViewById(R.id.videoPreview);

        preview.attachStream(publish);

        publish.attachCamera(camera);

        //preview.showDebugView(true);

        publish.publish(streamName, R5Stream.RecordType.Live);

        cam.startPreview();

    } catch (Exception e)
    {
        e.printStackTrace();
    }
}
protected Camera openFrontFacingCameraGingerbread() {
    int cameraCount = 0;
    Camera cam = null;
    Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
    cameraCount = Camera.getNumberOfCameras();
    for (int camIdx = 0; camIdx < cameraCount; camIdx++) {
        Camera.getCameraInfo(camIdx, cameraInfo);
        if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT)

{ try { cam = Camera.open(camIdx); camOrientation = cameraInfo.orientation; //applyDeviceRotation(); break; } catch (RuntimeException e) { e.printStackTrace(); } } }

    return cam;
}protected void applyDeviceRotation(){
    int rotation =

getActivity().getWindowManager().getDefaultDisplay().getRotation(); int degrees = 0; switch (rotation) { case Surface.ROTATION_0: degrees = 0; break; case Surface.ROTATION_90: degrees = 90; break; case Surface.ROTATION_180: degrees = 180; break; case Surface.ROTATION_270: degrees = 270; break; }

    camOrientation += degrees;

    camOrientation = camOrientation%360;
}

public Activity getActivity() {
    return this;
}
@Override
public void onStop() {

    if (publish != null){
        publish.stop();

        if(publish.getVideoSource() != null) {
            Camera c = ((R5Camera)

publish.getVideoSource()).getCamera(); c.stopPreview(); c.release(); } publish = null;

    }

    super.onStop();
}

}

On Mon, Mar 6, 2017 at 1:15 PM, Holden Mills notifications@github.com wrote:

Unfortunately, we do not support the use of virtual devices. You will have to use a physical device to test.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/red5pro/streaming-android/issues/67#issuecomment-284501018, or mute the thread https://github.com/notifications/unsubscribe-auth/AJctDqXHVapLS268dTYtzCCcQhEcOGkyks5rjFtagaJpZM4MHpbp .

notmark commented 7 years ago

Nevermind, I'm an idiot. I left out the dependency in build.gradle

compile 'org.apache.mina:mina-core:2.0.7'

On Mon, Mar 6, 2017 at 3:04 PM, Mark Vaughn mark@vaughnsoft.com wrote:

Okay. So I threw together a basic example using the link you gave, also included the lib and libraries from the sdk zip. I'm able to get a camera preview in the app, however I get an odd error when the app reaches publish.publish(streamName, R5Stream.RecordType.Live);

E/AndroidRuntime: FATAL EXCEPTION: Thread-71872

Process: vaughnsoft.marvin.deez4, PID: 26118

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/mina/core/buffer/IoBuffer;

at com.red5pro.streaming.core.l.a(Unknown Source)

at com.red5pro.streaming.R5Stream.write(Unknown Source)

at com.red5pro.streaming.source.c.run(Unknown Source)

at java.lang.Thread.run(Thread.java:818)

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.mina.core.buffer.IoBuffer" on path: DexPathList[[zip file "/data/app/vaughnsoft.marvin.deez4-2/base.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_dependencies_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_0_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_1_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_2_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_3_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_4_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_5_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_6_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_7_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_8_apk.apk", zip file "/data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_9_apk.apk"], nativeLibraryDirectories=[/data/app/vaughnsoft.marvin.deez4-2/lib/arm, /data/app/vaughnsoft.marvin.deez4-2/base.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_8_apk.apk!/lib/armeabi-v7a, /data/app/vaughnsoft.marvin.deez4-2/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]

at dalvik.system.BaseDexClassLoader.findClass( BaseDexClassLoader.java:56)

at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

at com.red5pro.streaming.core.l.a(Unknown Source)

at com.red5pro.streaming.R5Stream.write(Unknown Source)

at com.red5pro.streaming.source.c.run(Unknown Source)

at java.lang.Thread.run(Thread.java:818) Suppressed: java.lang.ClassNotFoundException: org.apache.mina.core.buffer.IoBuffer

at java.lang.Class.classForName(Native Method)

at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

... 5 more

Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

Here is the code I'm using:

package vaughnsoft.marvin.deez4;

import android.app.Activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.hardware.Camera; import android.view.Surface;

import com.red5pro.streaming.R5Connection; import com.red5pro.streaming.R5Stream; import com.red5pro.streaming.R5StreamProtocol; import com.red5pro.streaming.config.R5Configuration; import com.red5pro.streaming.source.R5Camera; import com.red5pro.streaming.source.R5Microphone; import com.red5pro.streaming.view.R5VideoView;

public class MainActivity extends AppCompatActivity {

protected R5VideoView preview;
protected R5Stream publish;
protected Camera cam;
protected int camOrientation;

private static String serverHost = "198.255.17.18";
private static int serverPort = 8554;
private static String serverApp = "live";
private static Float serverBufferTime = 0.2f;

private static int videoWidth = 360;
private static int videoHeight = 640;
private static int videoBitrate = 750;

private static String streamName = "live_1234_zxcv";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    try {
        R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP,

serverHost, serverPort, serverApp, serverBufferTime); R5Connection connection = new R5Connection(config); //setup a new stream using the connection publish = new R5Stream(connection); R5Camera camera = null; //attach a camera video source cam = openFrontFacingCameraGingerbread(); cam.setDisplayOrientation((camOrientation + 180) % 360);

        camera = new R5Camera(cam, videoWidth, videoHeight);
        camera.setBitrate(videoBitrate);
        camera.setOrientation(camOrientation);
        //attach a microphone
        R5Microphone mic = new R5Microphone();
        publish.attachMic(mic);

        preview = (R5VideoView) this.findViewById(R.id.videoPreview);

        preview.attachStream(publish);

        publish.attachCamera(camera);

        //preview.showDebugView(true);

        publish.publish(streamName, R5Stream.RecordType.Live);

        cam.startPreview();

    } catch (Exception e)
    {
        e.printStackTrace();
    }
}
protected Camera openFrontFacingCameraGingerbread() {
    int cameraCount = 0;
    Camera cam = null;
    Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
    cameraCount = Camera.getNumberOfCameras();
    for (int camIdx = 0; camIdx < cameraCount; camIdx++) {
        Camera.getCameraInfo(camIdx, cameraInfo);
        if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT)

{ try { cam = Camera.open(camIdx); camOrientation = cameraInfo.orientation; //applyDeviceRotation(); break; } catch (RuntimeException e) { e.printStackTrace(); } } }

    return cam;
}protected void applyDeviceRotation(){
    int rotation = getActivity().getWindowManager().

getDefaultDisplay().getRotation(); int degrees = 0; switch (rotation) { case Surface.ROTATION_0: degrees = 0; break; case Surface.ROTATION_90: degrees = 90; break; case Surface.ROTATION_180: degrees = 180; break; case Surface.ROTATION_270: degrees = 270; break; }

    camOrientation += degrees;

    camOrientation = camOrientation%360;
}

public Activity getActivity() {
    return this;
}
@Override
public void onStop() {

    if (publish != null){
        publish.stop();

        if(publish.getVideoSource() != null) {
            Camera c = ((R5Camera) publish.getVideoSource()).

getCamera(); c.stopPreview(); c.release(); } publish = null;

    }

    super.onStop();
}

}

On Mon, Mar 6, 2017 at 1:15 PM, Holden Mills notifications@github.com wrote:

Unfortunately, we do not support the use of virtual devices. You will have to use a physical device to test.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/red5pro/streaming-android/issues/67#issuecomment-284501018, or mute the thread https://github.com/notifications/unsubscribe-auth/AJctDqXHVapLS268dTYtzCCcQhEcOGkyks5rjFtagaJpZM4MHpbp .

HoldenMills commented 7 years ago

Glad to hear you fixed it! I will close this issue out then. If you need anything else, please let me know