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

USB Camera support #45

Merged
merged 6 commits into from
Nov 24, 2023
Merged
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
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
import android.hardware.display.VirtualDisplay;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;

import androidx.annotation.Nullable;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.mockito.Mockito;
import org.webrtc.CapturerObserver;
import org.webrtc.ScreenCapturerAndroid;
Expand All @@ -28,6 +32,27 @@

public class ScreenCapturerAndroidTest {

@Rule
public TestWatcher watchman= new TestWatcher() {

@Override
protected void failed(Throwable e, Description description) {
Log.i("TestWatcher", "*** "+description + " failed!\n");
}

@Override
protected void succeeded(Description description) {
Log.i("TestWatcher", "*** "+description + " succeeded!\n");
}

protected void starting(Description description) {
Log.i("TestWatcher", "******\n*** "+description + " starting!\n");
}

protected void finished(Description description) {
Log.i("TestWatcher", "*** "+description + " finished!\n******\n");
}
};
@Test
public void testRotateScreen() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,11 @@ public void testCreatePeerConnection() {

verify(webRTCClient, never()).reportError(eq(streamId), anyString());

try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
doThrow(new NullPointerException()).when(webRTCClient).createMediaConstraintsInternal();
webRTCClient.createPeerConnection(streamId);
verify(webRTCClient, timeout(10000)).reportError(eq(streamId), anyString());
Expand Down
8 changes: 8 additions & 0 deletions webrtc-android-sample-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ android {
}
}

packagingOptions {
pickFirst 'lib/arm64-v8a/libyuv.so'
pickFirst 'lib/armeabi-v7a/libyuv.so'

}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -97,5 +103,7 @@ dependencies {
androidTestImplementation 'com.squareup.okhttp3:okhttp:4.9.3'
androidTestImplementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
androidTestImplementation 'com.google.code.gson:gson:2.8.9'
implementation(name: 'sdk_uvc_camera_v23092707_debug', ext: 'aar')


}
Binary file not shown.
8 changes: 8 additions & 0 deletions webrtc-android-sample-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.usb.host" />
<uses-permission android:name="android.permission.USB_PERMISSION" />

<application
android:allowBackup="true"
Expand Down Expand Up @@ -107,6 +109,12 @@
android:theme="@style/Theme.AppCompat.DayNight"
android:configChanges="orientation|keyboard|screenSize|smallestScreenSize|screenLayout"/> <!-- Let the orientation handled by the activity. It resolves websocket disconnection issue-->

<activity android:name=".USBCameraActivity"
android:exported="true"
android:theme="@style/Theme.AppCompat.DayNight"
android:configChanges="orientation|keyboard|screenSize|smallestScreenSize|screenLayout"/> <!-- Let the orientation handled by the activity. It resolves websocket disconnection issue-->

<receiver android:name="io.antmedia.webrtc_android_sample_app.ScreenCaptureActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package io.antmedia.webrtc_android_sample_app;

import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.Toast;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -54,6 +48,8 @@ private void createList() {
"Conference"));
activities.add(new ActivityLink(new Intent(this, ScreenCaptureActivity.class),
"Screen Capture"));
activities.add(new ActivityLink(new Intent(this, USBCameraActivity.class),
"USB Camera"));
activities.add(new ActivityLink(new Intent(this, SettingsActivity.class),
"Settings"));
activities.add(new ActivityLink(new Intent(this, TrackBasedConferenceActivity.class),
Expand Down
Loading