diff --git a/.github/workflows/build-screen-sharing-java.yml b/.github/workflows/build-device-screen-sharing-java.yml
similarity index 77%
rename from .github/workflows/build-screen-sharing-java.yml
rename to .github/workflows/build-device-screen-sharing-java.yml
index 71fd11c9..29ce9c2c 100644
--- a/.github/workflows/build-screen-sharing-java.yml
+++ b/.github/workflows/build-device-screen-sharing-java.yml
@@ -1,4 +1,4 @@
-name: Build Screen-Sharing-Java
+name: Build Device-Screen-Sharing-Java
on:
push:
@@ -22,4 +22,4 @@ jobs:
java-version: 17
- name: Build
- run: cd Screen-Sharing-Java && ./gradlew app:assembleRelease && cd ..
+ run: cd Device-Screen-Sharing-Java && ./gradlew app:assembleRelease && cd ..
diff --git a/.github/workflows/build-screen-sharing-kotlin.yml b/.github/workflows/build-webview-screen-sharing-java.yml
similarity index 77%
rename from .github/workflows/build-screen-sharing-kotlin.yml
rename to .github/workflows/build-webview-screen-sharing-java.yml
index 9e2a1cac..309dc5d3 100644
--- a/.github/workflows/build-screen-sharing-kotlin.yml
+++ b/.github/workflows/build-webview-screen-sharing-java.yml
@@ -1,4 +1,4 @@
-name: Build Screen-Sharing-Kotlin
+name: Build Webview-Screen-Sharing-Java
on:
push:
@@ -22,4 +22,4 @@ jobs:
java-version: 17
- name: Build
- run: cd Screen-Sharing-Kotlin && ./gradlew app:assembleRelease && cd ..
+ run: cd Webview-Screen-Sharing-Java && ./gradlew app:assembleRelease && cd ..
diff --git a/.github/workflows/build-webview-screen-sharing-kotlin.yml b/.github/workflows/build-webview-screen-sharing-kotlin.yml
new file mode 100644
index 00000000..b24bbbc6
--- /dev/null
+++ b/.github/workflows/build-webview-screen-sharing-kotlin.yml
@@ -0,0 +1,25 @@
+name: Build Webview-Screen-Sharing-Kotlin
+
+on:
+ push:
+ branches: [main] # Just in case main was not up to date while merging PR
+ pull_request:
+ types: [opened, synchronize]
+
+jobs:
+ run:
+ continue-on-error: true
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ steps:
+ - name: checkout
+ uses: actions/checkout@v2
+
+ - name: Set up JDK
+ uses: actions/setup-java@v1
+ with:
+ java-version: 17
+
+ - name: Build
+ run: cd Webview-Screen-Sharing-Kotlin && ./gradlew app:assembleRelease && cd ..
diff --git a/Screen-Sharing-Java/.gitignore b/Device-Screen-Sharing-Java/.gitignore
similarity index 100%
rename from Screen-Sharing-Java/.gitignore
rename to Device-Screen-Sharing-Java/.gitignore
diff --git a/Device-Screen-Sharing-Java/README.md b/Device-Screen-Sharing-Java/README.md
new file mode 100644
index 00000000..84eb4ef6
--- /dev/null
+++ b/Device-Screen-Sharing-Java/README.md
@@ -0,0 +1,119 @@
+# Screen Sharing
+
+This app demonstrates how to use the Media Projection API as the source for screen-sharing video.
+
+> Check [Basic-Video-Capturer-Camera-2](../Basic-Video-Capturer-Camera-2) project to see how a device camera can be used as the video source for the custom `Capturer`.
+
+## Screen sharing
+
+The custom video capturer uses the Media Projection API to capture the device's screen and publish it as a video stream.
+
+When the app starts up, the `onCreate` method initializes the Media Projection API by requesting permission to capture the screen:
+
+```java
+mediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);
+startActivityForResult(mediaProjectionManager.createScreenCaptureIntent(), REQUEST_CODE);
+```
+
+Upon connecting to the OpenTok session, the app instantiates a `Publisher` object and calls its `setCapturer` method to use a custom video capturer, defined by the `ScreenSharingCapturer` class:
+
+```java
+@Override
+public void onConnected(Session session) {
+ ScreenSharingCapturer screenSharingCapturer = new ScreenSharingCapturer(MainActivity.this, mediaProjection);
+
+ publisher = new Publisher.Builder(MainActivity.this)
+ .capturer(screenSharingCapturer)
+ .build();
+
+ publisher.setPublisherListener(publisherListener);
+ publisher.setPublisherVideoType(PublisherKit.PublisherKitVideoType.PublisherKitVideoTypeScreen);
+ publisher.setAudioFallbackEnabled(false);
+
+ publisher.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
+ publisherViewContainer.addView(publisher.getView());
+
+ session.publish(publisher);
+}
+```
+
+> Note: The call to the `setPublisherVideoType` method sets the video type of the published stream to `PublisherKitVideoType.PublisherKitVideoTypeScreen`. This optimizes the video encoding for screen sharing. It is recommended to use a low frame rate (15 frames per second or lower) with this video type. When using the screen video type in a session that uses the [OpenTok Media Server](https://tokbox.com/opentok/tutorials/create-session/#media-mode), the audio-only fallback feature is disabled, so that the video does not drop out in subscribers.
+
+The `ScreenSharingCapturer` class uses the Media Projection API to capture the screen. The `getCaptureSettings` method initializes capture settings to be used by the custom video capturer:
+
+```java
+@Override
+public CaptureSettings getCaptureSettings() {
+
+ CaptureSettings captureSettings = new CaptureSettings();
+ captureSettings.fps = fps;
+ captureSettings.width = width;
+ captureSettings.height = height;
+ captureSettings.format = ARGB;
+ return captureSettings;
+}
+```
+
+The `startCapture` method starts the screen capture process:
+
+```java
+@Override
+public int startCapture() {
+ capturing = true;
+
+ virtualDisplay = mediaProjection.createVirtualDisplay(
+ "ScreenSharing",
+ width,
+ height,
+ density,
+ DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC,
+ surface,
+ null,
+ null
+ );
+
+ handler.postDelayed(newFrame, 1000 / fps);
+ return 0;
+}
+```
+
+The `backgroundHandler` thread captures frames from the virtual display, processes them, and sends them to the publisher:
+
+```java
+imageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
+ @Override
+ public void onImageAvailable(ImageReader reader) {
+ Image image = reader.acquireLatestImage();
+ if (image != null) {
+ Image.Plane[] planes = image.getPlanes();
+ ByteBuffer buffer = planes[0].getBuffer();
+ int pixelStride = planes[0].getPixelStride();
+ int rowStride = planes[0].getRowStride();
+
+ if (frame == null) {
+ frame = new int[width * height];
+ }
+
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ int index = y * rowStride + x * pixelStride;
+ int pixel = buffer.getInt(index);
+ frame[y * width + x] = pixel;
+ }
+ }
+
+ provideIntArrayFrame(frame, ABGR, width, height, 0, false);
+ image.close();
+ }
+ }
+ }, backgroundHandler);
+```
+
+The `provideIntArrayFrame` method, defined by the `BaseVideoCapturer` class, sends an integer array of data to the publisher, to be used for the next video frame published.
+
+If the publisher is still capturing video, the thread starts again after another 1/15 of a second, so that the capturer continues to supply the publisher with new video frames to publish.
+
+## Further Reading
+
+* Review [other sample projects](../)
+* Read more about [OpenTok Android SDK](https://tokbox.com/developer/sdks/android/)
diff --git a/Screen-Sharing-Java/app/.gitignore b/Device-Screen-Sharing-Java/app/.gitignore
similarity index 100%
rename from Screen-Sharing-Java/app/.gitignore
rename to Device-Screen-Sharing-Java/app/.gitignore
diff --git a/Device-Screen-Sharing-Java/app/build.gradle b/Device-Screen-Sharing-Java/app/build.gradle
new file mode 100644
index 00000000..0215b086
--- /dev/null
+++ b/Device-Screen-Sharing-Java/app/build.gradle
@@ -0,0 +1,40 @@
+plugins {
+ id 'com.android.application'
+}
+
+apply {
+ from '../../commons.gradle'
+}
+
+android {
+ namespace "com.tokbox.sample.devicescreensharing"
+ compileSdkVersion extCompileSdkVersion
+
+ defaultConfig {
+ applicationId "com.tokbox.sample.devicescreensharing"
+ minSdkVersion extMinSdkVersion
+ targetSdkVersion extTargetSdkVersion
+ versionCode extVersionCode
+ versionName extVersionName
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled extMinifyEnabled
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ // Dependency versions are defined in the ../../commons.gradle file
+ implementation "com.opentok.android:opentok-android-sdk:${extOpentokSdkVersion}"
+ implementation "androidx.appcompat:appcompat:${extAppCompatVersion}"
+ implementation "pub.devrel:easypermissions:${extEasyPermissionsVersion}"
+ implementation "androidx.constraintlayout:constraintlayout:${extConstraintLyoutVersion}"
+}
diff --git a/Device-Screen-Sharing-Java/app/src/main/AndroidManifest.xml b/Device-Screen-Sharing-Java/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..21a36a29
--- /dev/null
+++ b/Device-Screen-Sharing-Java/app/src/main/AndroidManifest.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/MainActivity.java b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/MainActivity.java
new file mode 100644
index 00000000..3c94c396
--- /dev/null
+++ b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/MainActivity.java
@@ -0,0 +1,297 @@
+package com.tokbox.sample.devicescreensharing;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ServiceInfo;
+import android.media.projection.MediaProjection;
+import android.media.projection.MediaProjectionManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.widget.FrameLayout;
+import android.widget.Toast;
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import com.opentok.android.BaseVideoRenderer;
+import com.opentok.android.OpentokError;
+import com.opentok.android.Publisher;
+import com.opentok.android.PublisherKit;
+import com.opentok.android.Session;
+import com.opentok.android.Stream;
+import com.opentok.android.Subscriber;
+import com.opentok.android.SubscriberKit;
+
+import pub.devrel.easypermissions.AfterPermissionGranted;
+import pub.devrel.easypermissions.EasyPermissions;
+import java.util.List;
+import java.util.ArrayList;
+
+public class MainActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks {
+
+ private static final String TAG = MainActivity.class.getSimpleName();
+ private static final int REQUEST_MEDIA_PROJECTION = 100;
+ private static final int PERMISSIONS_REQUEST_CODE = 124;
+ private Session session;
+ private Publisher publisher;
+ private Subscriber subscriber;
+
+ private FrameLayout publisherViewContainer;
+ private FrameLayout subscriberViewContainer;
+
+ private ScreenSharingManager screenSharingManager;
+ private ScreenSharingCapturer screenSharingCapturer;
+ private MediaProjectionManager mediaProjectionManager;
+ private MediaProjection mediaProjection;
+
+ private PublisherKit.PublisherListener publisherListener = new PublisherKit.PublisherListener() {
+ @Override
+ public void onStreamCreated(PublisherKit publisherKit, Stream stream) {
+ Log.d(TAG, "onStreamCreated: Own stream " + stream.getStreamId() + " created");
+ }
+
+ @Override
+ public void onStreamDestroyed(PublisherKit publisherKit, Stream stream) {
+ Log.d(TAG, "onStreamDestroyed: Own stream " + stream.getStreamId() + " destroyed");
+ }
+
+ @Override
+ public void onError(PublisherKit publisherKit, OpentokError opentokError) {
+ finishWithMessage("PublisherKit error: " + opentokError.getMessage());
+ }
+ };
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == REQUEST_MEDIA_PROJECTION) {
+ if (resultCode != AppCompatActivity.RESULT_OK || data == null) {
+ Toast.makeText(
+ this,
+ "screen_capture_permission_not_granted",
+ Toast.LENGTH_LONG)
+ .show();
+ return;
+ }
+ startScreenCapture(resultCode, data);
+ }
+ }
+
+ private void requestScreenCapturePermission() {
+ Log.d(TAG, "Requesting permission to capture screen");
+ mediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);
+
+ startActivityForResult(
+ mediaProjectionManager.createScreenCaptureIntent(), REQUEST_MEDIA_PROJECTION);
+ }
+
+ private void startScreenCapture(int resultCode, Intent data) {
+ if (screenSharingManager != null) {
+ // Ensure the service is bound
+ screenSharingManager.startForeground(); // this calls startForeground() in the service
+
+ // Wait until the service is started in the foreground before requesting MediaProjection
+ new Handler().postDelayed(() -> {
+ mediaProjection = mediaProjectionManager.getMediaProjection(resultCode, data);
+ ScreenSharingCapturer screenSharingCapturer =
+ new ScreenSharingCapturer(MainActivity.this, mediaProjection);
+
+ publisher = new Publisher.Builder(MainActivity.this)
+ .capturer(screenSharingCapturer)
+ .build();
+
+ publisher.setPublisherListener(publisherListener);
+ publisher.setPublisherVideoType(PublisherKit.PublisherKitVideoType.PublisherKitVideoTypeScreen);
+ publisher.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
+
+ publisherViewContainer.addView(publisher.getView());
+ session.publish(publisher);
+
+ }, 100); // small delay to ensure startForeground() has taken effect
+ }
+ }
+
+
+ private Session.SessionListener sessionListener = new Session.SessionListener() {
+ @Override
+ public void onConnected(Session session) {
+ Log.d(TAG, "onConnected: Connected to session " + session.getSessionId());
+
+ requestScreenCapturePermission();
+ }
+
+ @Override
+ public void onDisconnected(Session session) {
+ Log.d(TAG, "onDisconnected: disconnected from session " + session.getSessionId());
+
+ MainActivity.this.session = null;
+ }
+
+ @Override
+ public void onError(Session session, OpentokError opentokError) {
+ finishWithMessage("Session error: " + opentokError.getMessage());
+ }
+
+ @Override
+ public void onStreamReceived(Session session, Stream stream) {
+ Log.d(TAG, "onStreamReceived: New stream " + stream.getStreamId() + " in session " + session.getSessionId());
+
+ if (subscriber == null) {
+ subscriber = new Subscriber.Builder(MainActivity.this, stream).build();
+ subscriber.getRenderer().setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
+ subscriber.setSubscriberListener(subscriberListener);
+ session.subscribe(subscriber);
+ subscriberViewContainer.addView(subscriber.getView());
+ }
+ }
+
+ @Override
+ public void onStreamDropped(Session session, Stream stream) {
+ Log.d(TAG, "onStreamDropped: Stream " + stream.getStreamId() + " dropped from session " + session.getSessionId());
+
+ if (subscriber != null) {
+ subscriber = null;
+ subscriberViewContainer.removeAllViews();
+ }
+ }
+ };
+
+ SubscriberKit.SubscriberListener subscriberListener = new SubscriberKit.SubscriberListener() {
+ @Override
+ public void onConnected(SubscriberKit subscriberKit) {
+ Log.d(TAG, "onConnected: Subscriber connected. Stream: " + subscriberKit.getStream().getStreamId());
+ }
+
+ @Override
+ public void onDisconnected(SubscriberKit subscriberKit) {
+ Log.d(TAG, "onDisconnected: Subscriber disconnected. Stream: " + subscriberKit.getStream().getStreamId());
+ }
+
+ @Override
+ public void onError(SubscriberKit subscriberKit, OpentokError opentokError) {
+ finishWithMessage("SubscriberKit onError: " + opentokError.getMessage());
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ screenSharingManager = new ScreenSharingManager(this);
+
+ if(!OpenTokConfig.isValid()) {
+ finishWithMessage("Invalid OpenTokConfig. " + OpenTokConfig.getDescription());
+ return;
+ }
+
+ publisherViewContainer = findViewById(R.id.publisher_container);
+ subscriberViewContainer = findViewById(R.id.subscriber_container);
+
+ requestPermissions();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+
+ if (session == null) {
+ return;
+ }
+
+ session.onPause();
+
+ if (isFinishing()) {
+ disconnectSession();
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ if (session == null) {
+ return;
+ }
+
+ session.onResume();
+ }
+
+ @Override
+ protected void onDestroy() {
+ disconnectSession();
+
+ super.onDestroy();
+ }
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
+ }
+
+ @Override
+ public void onPermissionsGranted(int requestCode, List perms) {
+ Log.d(TAG, "onPermissionsGranted:" + requestCode + ": " + perms);
+ }
+
+ @Override
+ public void onPermissionsDenied(int requestCode, List perms) {
+ finishWithMessage("onPermissionsDenied: " + requestCode + ": " + perms);
+ }
+
+ @AfterPermissionGranted(PERMISSIONS_REQUEST_CODE)
+ private void requestPermissions() {
+ ArrayList permsList = new ArrayList<>();
+ permsList.add(Manifest.permission.INTERNET);
+ permsList.add(Manifest.permission.CAMERA);
+ permsList.add(Manifest.permission.RECORD_AUDIO);
+ permsList.add(Manifest.permission.FOREGROUND_SERVICE);
+
+ // Add FOREGROUND_SERVICE_MEDIA_PROJECTION permission if API level is 34 or higher
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+ permsList.add(Manifest.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION);
+ }
+
+ String[] perms = permsList.toArray(new String[0]);
+
+ if (EasyPermissions.hasPermissions(this, perms)) {
+ initializeSession(OpenTokConfig.API_KEY, OpenTokConfig.SESSION_ID, OpenTokConfig.TOKEN);
+ } else {
+ EasyPermissions.requestPermissions(this, getString(R.string.rationale_video_app), PERMISSIONS_REQUEST_CODE, perms);
+ }
+ }
+
+ private void initializeSession(String apiKey, String sessionId, String token) {
+ Log.i(TAG, "apiKey: " + apiKey);
+ Log.i(TAG, "sessionId: " + sessionId);
+ Log.i(TAG, "token: " + token);
+
+ /*
+ The context used depends on the specific use case, but usually, it is desired for the session to
+ live outside of the Activity e.g: live between activities. For a production applications,
+ it's convenient to use Application context instead of Activity context.
+ */
+ session = new Session.Builder(this, apiKey, sessionId).build();
+ session.setSessionListener(sessionListener);
+ session.connect(token);
+ }
+
+ private void disconnectSession() {
+ if (session == null) {
+ return;
+ }
+
+ if (publisher != null) {
+ publisherViewContainer.removeView(publisher.getView());
+ session.unpublish(publisher);
+ publisher = null;
+ }
+ session.disconnect();
+ }
+
+ private void finishWithMessage(String message) {
+ Log.e(TAG, message);
+ Toast.makeText(this, message, Toast.LENGTH_LONG).show();
+ this.finish();
+ }
+}
diff --git a/Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/OpenTokConfig.java b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/OpenTokConfig.java
similarity index 95%
rename from Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/OpenTokConfig.java
rename to Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/OpenTokConfig.java
index 0af57414..03babc0a 100644
--- a/Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/OpenTokConfig.java
+++ b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/OpenTokConfig.java
@@ -1,4 +1,4 @@
-package com.tokbox.sample.screensharing;
+package com.tokbox.sample.devicescreensharing;
import android.text.TextUtils;
import androidx.annotation.NonNull;
diff --git a/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingCapturer.java b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingCapturer.java
new file mode 100644
index 00000000..d93df5f7
--- /dev/null
+++ b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingCapturer.java
@@ -0,0 +1,174 @@
+package com.tokbox.sample.devicescreensharing;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.PixelFormat;
+import android.graphics.SurfaceTexture;
+import android.hardware.display.DisplayManager;
+import android.hardware.display.VirtualDisplay;
+import android.media.Image;
+import android.media.ImageReader;
+import android.media.projection.MediaProjection;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Looper;
+import android.util.DisplayMetrics;
+import android.view.Surface;
+import android.view.View;
+import android.view.WindowManager;
+import android.webkit.WebView;
+
+import java.nio.ByteBuffer;
+
+import com.opentok.android.BaseVideoCapturer;
+
+public class ScreenSharingCapturer extends BaseVideoCapturer {
+
+ private MediaProjection mediaProjection;
+ private ImageReader imageReader;
+ private VirtualDisplay virtualDisplay;
+ private Handler backgroundHandler;
+ private HandlerThread backgroundThread;
+
+ private Context context;
+
+ private boolean capturing = false;
+
+ private int fps = 15;
+ private int width = 0;
+ private int height = 0;
+
+ public ScreenSharingCapturer(Context context, MediaProjection mediaProjection) {
+ this.context = context;
+ this.mediaProjection = mediaProjection;
+ initDisplayMetrics();
+ }
+
+ private void initDisplayMetrics() {
+ WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ if (windowManager != null) {
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ windowManager.getDefaultDisplay().getMetrics(displayMetrics);
+ width = displayMetrics.widthPixels;
+ height = displayMetrics.heightPixels;
+ }
+ }
+
+ @SuppressLint("WrongConstant")
+ @Override
+ public void init() {
+ imageReader = ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, 2);
+ startBackgroundThread();
+ }
+
+ private void createVirtualDisplay() {
+
+ mediaProjection.registerCallback(new MediaProjection.Callback() {
+ @Override
+ public void onStop() {
+ // MediaProjection was stopped, release resources
+ if (virtualDisplay != null) {
+ virtualDisplay.release();
+ virtualDisplay = null;
+ }
+ }
+ }, new Handler(Looper.getMainLooper()));
+
+ virtualDisplay = mediaProjection.createVirtualDisplay(
+ "ScreenSharing",
+ width, height, context.getResources().getDisplayMetrics().densityDpi,
+ DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
+ imageReader.getSurface(),
+ null,
+ backgroundHandler
+ );
+
+ imageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
+ @Override
+ public void onImageAvailable(ImageReader reader) {
+ Image image = reader.acquireLatestImage();
+ if (image != null) {
+ Image.Plane[] planes = image.getPlanes();
+ ByteBuffer buffer = planes[0].getBuffer();
+ int pixelStride = planes[0].getPixelStride();
+ int rowStride = planes[0].getRowStride();
+
+ provideBufferFrame(planes[0].getBuffer(), ABGR, width, height, 0, false);
+ image.close();
+ }
+ }
+ }, backgroundHandler);
+ }
+
+ @Override
+ public int startCapture() {
+ capturing = true;
+ return 0;
+ }
+
+ @Override
+ public int stopCapture() {
+ capturing = false;
+ if (virtualDisplay != null) {
+ virtualDisplay.release();
+ }
+ if (mediaProjection != null) {
+ mediaProjection.stop();
+ }
+ stopBackgroundThread();
+ return 0;
+
+ }
+
+ @Override
+ public boolean isCaptureStarted() {
+ return capturing;
+ }
+
+ @Override
+ public CaptureSettings getCaptureSettings() {
+
+ CaptureSettings captureSettings = new CaptureSettings();
+ captureSettings.fps = fps;
+ captureSettings.width = width;
+ captureSettings.height = height;
+ captureSettings.format = ABGR;
+ return captureSettings;
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
+ @Override
+ public void onPause() {
+
+ }
+
+ @Override
+ public void onResume() {
+
+ }
+
+ private void startBackgroundThread() {
+ createVirtualDisplay();
+ backgroundThread = new HandlerThread("ScreenCapture");
+ backgroundThread.start();
+ backgroundHandler = new Handler(backgroundThread.getLooper());
+ }
+
+ private void stopBackgroundThread() {
+ backgroundThread.quitSafely();
+ try {
+ backgroundThread.join();
+ backgroundThread = null;
+ backgroundHandler = null;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingManager.java b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingManager.java
new file mode 100644
index 00000000..e836370b
--- /dev/null
+++ b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingManager.java
@@ -0,0 +1,65 @@
+package com.tokbox.sample.devicescreensharing;
+
+import android.annotation.TargetApi;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.IBinder;
+
+public class ScreenSharingManager {
+ private ScreenSharingService mService;
+ private Context mContext;
+ private State currentState = State.UNBIND_SERVICE;
+
+ /** Defines callbacks for service binding, passed to bindService() */
+ private ServiceConnection connection =
+ new ServiceConnection() {
+
+ @Override
+ public void onServiceConnected(ComponentName className, IBinder service) {
+ // We've bound to ScreenCapturerService, cast the IBinder and get
+ // ScreenCapturerService instance
+ ScreenSharingService.LocalBinder binder =
+ (ScreenSharingService.LocalBinder) service;
+ mService = binder.getService();
+ currentState = State.BIND_SERVICE;
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName arg0) {}
+ };
+
+ /** An enum describing the possible states of a ScreenCapturerManager. */
+ public enum State {
+ BIND_SERVICE,
+ START_FOREGROUND,
+ END_FOREGROUND,
+ UNBIND_SERVICE
+ }
+
+ ScreenSharingManager(Context context) {
+ mContext = context;
+ bindService();
+ }
+
+ private void bindService() {
+ Intent intent = new Intent(mContext, ScreenSharingService.class);
+ mContext.bindService(intent, connection, Context.BIND_AUTO_CREATE);
+ }
+
+ void startForeground() {
+ mService.startForeground();
+ currentState = State.START_FOREGROUND;
+ }
+
+ void endForeground() {
+ mService.endForeground();
+ currentState = State.END_FOREGROUND;
+ }
+
+ void unbindService() {
+ mContext.unbindService(connection);
+ currentState = State.UNBIND_SERVICE;
+ }
+}
diff --git a/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingService.java b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingService.java
new file mode 100644
index 00000000..6fde105d
--- /dev/null
+++ b/Device-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/devicescreensharing/ScreenSharingService.java
@@ -0,0 +1,85 @@
+package com.tokbox.sample.devicescreensharing;
+
+import android.annotation.TargetApi;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ServiceInfo;
+import android.os.Binder;
+import android.os.Build;
+import android.os.IBinder;
+import androidx.core.app.NotificationCompat;
+
+@TargetApi(29)
+public class ScreenSharingService extends Service {
+ private static final String CHANNEL_ID = "screen_capture";
+ private static final String CHANNEL_NAME = "Screen_Capture";
+ private static final int NOTIFICATION_ID = 123;
+ Notification notification;
+
+ // Binder given to clients
+ private final IBinder binder = new LocalBinder();
+
+ /**
+ * Class used for the client Binder. We know this service always runs in the same process as its
+ * clients, we don't need to deal with IPC.
+ */
+ public class LocalBinder extends Binder {
+ public ScreenSharingService getService() {
+ // Return this instance of ScreenCapturerService so clients can call public methods
+ return ScreenSharingService.this;
+ }
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ createNotificationChannel();
+ notification = createNotification();
+ }
+
+ private void createNotificationChannel() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ NotificationChannel channel = new NotificationChannel(
+ CHANNEL_ID,
+ "Screen Sharing",
+ NotificationManager.IMPORTANCE_DEFAULT
+ );
+ NotificationManager manager = getSystemService(NotificationManager.class);
+ if (manager != null) {
+ manager.createNotificationChannel(channel);
+ }
+ }
+ }
+
+ private Notification createNotification() {
+ return new NotificationCompat.Builder(this, CHANNEL_ID)
+ .setContentTitle("Screen Sharing")
+ .setContentText("Screen sharing is active")
+ .setSmallIcon(R.mipmap.ic_launcher)
+ .setPriority(NotificationCompat.PRIORITY_DEFAULT)
+ .build();
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
+ return START_NOT_STICKY;
+ }
+
+ public void startForeground() {
+ startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
+ }
+
+ public void endForeground() {
+ stopForeground(true);
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return binder;
+ }
+}
\ No newline at end of file
diff --git a/Device-Screen-Sharing-Java/app/src/main/res/layout/activity_main.xml b/Device-Screen-Sharing-Java/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 00000000..7d2f43ac
--- /dev/null
+++ b/Device-Screen-Sharing-Java/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Screen-Sharing-Java/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Device-Screen-Sharing-Java/app/src/main/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/mipmap-hdpi/ic_launcher.png
rename to Device-Screen-Sharing-Java/app/src/main/res/mipmap-hdpi/ic_launcher.png
diff --git a/Screen-Sharing-Java/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Device-Screen-Sharing-Java/app/src/main/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/mipmap-mdpi/ic_launcher.png
rename to Device-Screen-Sharing-Java/app/src/main/res/mipmap-mdpi/ic_launcher.png
diff --git a/Screen-Sharing-Java/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Device-Screen-Sharing-Java/app/src/main/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/mipmap-xhdpi/ic_launcher.png
rename to Device-Screen-Sharing-Java/app/src/main/res/mipmap-xhdpi/ic_launcher.png
diff --git a/Screen-Sharing-Java/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Device-Screen-Sharing-Java/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
rename to Device-Screen-Sharing-Java/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/Screen-Sharing-Java/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Device-Screen-Sharing-Java/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
rename to Device-Screen-Sharing-Java/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/Screen-Sharing-Java/app/src/main/res/values-w820dp/dimens.xml b/Device-Screen-Sharing-Java/app/src/main/res/values-w820dp/dimens.xml
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/values-w820dp/dimens.xml
rename to Device-Screen-Sharing-Java/app/src/main/res/values-w820dp/dimens.xml
diff --git a/Screen-Sharing-Java/app/src/main/res/values/colors.xml b/Device-Screen-Sharing-Java/app/src/main/res/values/colors.xml
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/values/colors.xml
rename to Device-Screen-Sharing-Java/app/src/main/res/values/colors.xml
diff --git a/Screen-Sharing-Java/app/src/main/res/values/dimens.xml b/Device-Screen-Sharing-Java/app/src/main/res/values/dimens.xml
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/values/dimens.xml
rename to Device-Screen-Sharing-Java/app/src/main/res/values/dimens.xml
diff --git a/Screen-Sharing-Java/app/src/main/res/values/strings.xml b/Device-Screen-Sharing-Java/app/src/main/res/values/strings.xml
similarity index 71%
rename from Screen-Sharing-Java/app/src/main/res/values/strings.xml
rename to Device-Screen-Sharing-Java/app/src/main/res/values/strings.xml
index 7367ce56..e769538c 100644
--- a/Screen-Sharing-Java/app/src/main/res/values/strings.xml
+++ b/Device-Screen-Sharing-Java/app/src/main/res/values/strings.xml
@@ -1,4 +1,4 @@
- Screen-Sharing
+ Device-Screen-Sharing
This app needs access to your camera and mic so you can perform video calls
diff --git a/Screen-Sharing-Java/app/src/main/res/values/styles.xml b/Device-Screen-Sharing-Java/app/src/main/res/values/styles.xml
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/values/styles.xml
rename to Device-Screen-Sharing-Java/app/src/main/res/values/styles.xml
diff --git a/Screen-Sharing-Java/build.gradle b/Device-Screen-Sharing-Java/build.gradle
similarity index 100%
rename from Screen-Sharing-Java/build.gradle
rename to Device-Screen-Sharing-Java/build.gradle
diff --git a/Screen-Sharing-Java/gradle.properties b/Device-Screen-Sharing-Java/gradle.properties
similarity index 100%
rename from Screen-Sharing-Java/gradle.properties
rename to Device-Screen-Sharing-Java/gradle.properties
diff --git a/Device-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.jar b/Device-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..d64cd491
Binary files /dev/null and b/Device-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/Device-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.properties b/Device-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..b82aa23a
--- /dev/null
+++ b/Device-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/Device-Screen-Sharing-Java/gradlew b/Device-Screen-Sharing-Java/gradlew
new file mode 100755
index 00000000..1aa94a42
--- /dev/null
+++ b/Device-Screen-Sharing-Java/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# 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
+#
+# https://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.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/Device-Screen-Sharing-Java/gradlew.bat b/Device-Screen-Sharing-Java/gradlew.bat
new file mode 100644
index 00000000..6689b85b
--- /dev/null
+++ b/Device-Screen-Sharing-Java/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/Screen-Sharing-Java/settings.gradle b/Device-Screen-Sharing-Java/settings.gradle
similarity index 100%
rename from Screen-Sharing-Java/settings.gradle
rename to Device-Screen-Sharing-Java/settings.gradle
diff --git a/README.md b/README.md
index fcbb911b..ab362860 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,10 @@ The Android projects in this directory demonstrate typical use cases and feature
- Basic-Audio-Driver ([Java](./Basic-Audio-Driver-Java), [Kotlin](./Basic-Audio-Driver-Kotlin)) demonstrates how to publish a random audio signal and save audio streams to the file.
- Advanced-Audio-Driver ([Java](./Advanced-Audio-Driver-Java), [Kotlin](./Advanced-Audio-Driver-Kotlin)) demonstrates how to create a more advanced custom audio driver
- Basic-Video-Driver ([Java](./Basic-Video-Driver-Java)) demonstrates how to create a custom video driver
+- Device-Screen-Sharing ([Java](./Device-Screen-Sharing-Java)) demonstrates how to publish a screen-sharing video, using the entire device screen as the source
- Live-Photo-Capture ([Java](./Live-Photo-Capture-Java), [Kotlin](./Live-Photo-Capture-Kotlin)) demonstrates how to capture an image from a subscribed video stream
- Picture-In-Picture ([Java](./Picture-In-Picture-Java)) demonstrates how to use the [Picture-in-Picture](https://developer.android.com/guide/topics/ui/picture-in-picture) mode
-- Screen-Sharing ([Java](./Screen-Sharing-Java), [Kotlin](./Screen-Sharing-Kotlin)) demonstrates how to publish a screen-sharing video, using the WebView as the source
+- Webview-Screen-Sharing ([Java](./Webview-Screen-Sharing-Java), [Kotlin](./Webview-Screen-Sharing-Kotlin)) demonstrates how to publish a webview-screen-sharing video, using the WebView as the source
- Phone-Call-Detection ([Java](./Phone-Call-Detection-Java), [Kotlin](./Phone-Call-Detection-Kotlin)) demonstrates how to detect incoming and outgoing phone calls
- ARCore-Integration ([Java](./ARCore-Integration-Java)) demonstrates how to use Google [ARCore](https://developers.google.com/ar) with Opentok
- Basic-VoIP-Call ([Java](./Basic-VoIP-Call-Java)) demonstrates how to use Android Connection Service (https://developer.android.com/reference/android/telecom/ConnectionService) with the OpenTok Android SDK.
diff --git a/Screen-Sharing-Kotlin/.gitignore b/Webview-Screen-Sharing-Java/.gitignore
similarity index 100%
rename from Screen-Sharing-Kotlin/.gitignore
rename to Webview-Screen-Sharing-Java/.gitignore
diff --git a/Screen-Sharing-Java/README.md b/Webview-Screen-Sharing-Java/README.md
similarity index 99%
rename from Screen-Sharing-Java/README.md
rename to Webview-Screen-Sharing-Java/README.md
index a2cd565c..dbec97ef 100644
--- a/Screen-Sharing-Java/README.md
+++ b/Webview-Screen-Sharing-Java/README.md
@@ -1,4 +1,4 @@
-# Screen Sharing
+# Webview Screen Sharing
This app shows how to use `WebView` as the source for screen-sharing video.
diff --git a/Webview-Screen-Sharing-Java/app/.gitignore b/Webview-Screen-Sharing-Java/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/Webview-Screen-Sharing-Java/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/Screen-Sharing-Java/app/build.gradle b/Webview-Screen-Sharing-Java/app/build.gradle
similarity index 89%
rename from Screen-Sharing-Java/app/build.gradle
rename to Webview-Screen-Sharing-Java/app/build.gradle
index b4d37d7b..a3236a01 100644
--- a/Screen-Sharing-Java/app/build.gradle
+++ b/Webview-Screen-Sharing-Java/app/build.gradle
@@ -7,11 +7,11 @@ apply {
}
android {
- namespace "com.tokbox.sample.screensharing"
+ namespace "com.tokbox.sample.webviewscreensharing"
compileSdkVersion extCompileSdkVersion
defaultConfig {
- applicationId "com.tokbox.sample.screensharing"
+ applicationId "com.tokbox.sample.webviewscreensharing"
minSdkVersion extMinSdkVersion
targetSdkVersion extTargetSdkVersion
versionCode extVersionCode
diff --git a/Screen-Sharing-Java/app/src/main/AndroidManifest.xml b/Webview-Screen-Sharing-Java/app/src/main/AndroidManifest.xml
similarity index 94%
rename from Screen-Sharing-Java/app/src/main/AndroidManifest.xml
rename to Webview-Screen-Sharing-Java/app/src/main/AndroidManifest.xml
index 63a78a4d..4ee3ba77 100644
--- a/Screen-Sharing-Java/app/src/main/AndroidManifest.xml
+++ b/Webview-Screen-Sharing-Java/app/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="com.tokbox.sample.webviewscreensharing">
diff --git a/Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/MainActivity.java b/Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/MainActivity.java
similarity index 99%
rename from Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/MainActivity.java
rename to Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/MainActivity.java
index 2e9c9752..41a32131 100644
--- a/Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/MainActivity.java
+++ b/Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/MainActivity.java
@@ -1,4 +1,4 @@
-package com.tokbox.sample.screensharing;
+package com.tokbox.sample.webviewscreensharing;
import android.Manifest;
import android.os.Bundle;
diff --git a/Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/OpenTokConfig.java b/Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/OpenTokConfig.java
new file mode 100644
index 00000000..f23c56b2
--- /dev/null
+++ b/Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/OpenTokConfig.java
@@ -0,0 +1,38 @@
+package com.tokbox.sample.webviewscreensharing;
+
+import android.text.TextUtils;
+import androidx.annotation.NonNull;
+
+public class OpenTokConfig {
+ /*
+ Fill the following variables using your own Project info from the OpenTok dashboard
+ https://dashboard.tokbox.com/projects
+ */
+
+ // Replace with a API key
+ public static final String API_KEY = "";
+
+ // Replace with a generated Session ID
+ public static final String SESSION_ID = "";
+
+ // Replace with a generated token (from the dashboard or using an OpenTok server SDK)
+ public static final String TOKEN = "";
+
+ public static boolean isValid() {
+ if (TextUtils.isEmpty(OpenTokConfig.API_KEY)
+ || TextUtils.isEmpty(OpenTokConfig.SESSION_ID)
+ || TextUtils.isEmpty(OpenTokConfig.TOKEN)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @NonNull
+ public static String getDescription() {
+ return "OpenTokConfig:" + "\n"
+ + "API_KEY: " + OpenTokConfig.API_KEY + "\n"
+ + "SESSION_ID: " + OpenTokConfig.SESSION_ID + "\n"
+ + "TOKEN: " + OpenTokConfig.TOKEN + "\n";
+ }
+}
diff --git a/Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/ScreenSharingCapturer.java b/Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/ScreenSharingCapturer.java
similarity index 98%
rename from Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/ScreenSharingCapturer.java
rename to Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/ScreenSharingCapturer.java
index 1578bd94..e53bcec5 100644
--- a/Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/screensharing/ScreenSharingCapturer.java
+++ b/Webview-Screen-Sharing-Java/app/src/main/java/com/tokbox/sample/webviewscreensharing/ScreenSharingCapturer.java
@@ -1,4 +1,4 @@
-package com.tokbox.sample.screensharing;
+package com.tokbox.sample.webviewscreensharing;
import android.content.Context;
import android.graphics.Bitmap;
diff --git a/Screen-Sharing-Java/app/src/main/res/layout/activity_main.xml b/Webview-Screen-Sharing-Java/app/src/main/res/layout/activity_main.xml
similarity index 100%
rename from Screen-Sharing-Java/app/src/main/res/layout/activity_main.xml
rename to Webview-Screen-Sharing-Java/app/src/main/res/layout/activity_main.xml
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Webview-Screen-Sharing-Java/app/src/main/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png
rename to Webview-Screen-Sharing-Java/app/src/main/res/mipmap-hdpi/ic_launcher.png
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Webview-Screen-Sharing-Java/app/src/main/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png
rename to Webview-Screen-Sharing-Java/app/src/main/res/mipmap-mdpi/ic_launcher.png
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Webview-Screen-Sharing-Java/app/src/main/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png
rename to Webview-Screen-Sharing-Java/app/src/main/res/mipmap-xhdpi/ic_launcher.png
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Webview-Screen-Sharing-Java/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
rename to Webview-Screen-Sharing-Java/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Webview-Screen-Sharing-Java/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
rename to Webview-Screen-Sharing-Java/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/values-w820dp/dimens.xml b/Webview-Screen-Sharing-Java/app/src/main/res/values-w820dp/dimens.xml
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/values-w820dp/dimens.xml
rename to Webview-Screen-Sharing-Java/app/src/main/res/values-w820dp/dimens.xml
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/values/colors.xml b/Webview-Screen-Sharing-Java/app/src/main/res/values/colors.xml
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/values/colors.xml
rename to Webview-Screen-Sharing-Java/app/src/main/res/values/colors.xml
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/values/dimens.xml b/Webview-Screen-Sharing-Java/app/src/main/res/values/dimens.xml
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/values/dimens.xml
rename to Webview-Screen-Sharing-Java/app/src/main/res/values/dimens.xml
diff --git a/Webview-Screen-Sharing-Java/app/src/main/res/values/strings.xml b/Webview-Screen-Sharing-Java/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..729df24a
--- /dev/null
+++ b/Webview-Screen-Sharing-Java/app/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+ Webview-Screen-Sharing
+ This app needs access to your camera and mic so you can perform video calls
+
diff --git a/Webview-Screen-Sharing-Java/app/src/main/res/values/styles.xml b/Webview-Screen-Sharing-Java/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..5885930d
--- /dev/null
+++ b/Webview-Screen-Sharing-Java/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/Webview-Screen-Sharing-Java/build.gradle b/Webview-Screen-Sharing-Java/build.gradle
new file mode 100644
index 00000000..540c87f1
--- /dev/null
+++ b/Webview-Screen-Sharing-Java/build.gradle
@@ -0,0 +1,9 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ id 'com.android.application' version '8.6.0' apply false
+ id 'com.android.library' version '8.6.0' apply false
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/Screen-Sharing-Kotlin/gradle.properties b/Webview-Screen-Sharing-Java/gradle.properties
similarity index 100%
rename from Screen-Sharing-Kotlin/gradle.properties
rename to Webview-Screen-Sharing-Java/gradle.properties
diff --git a/Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.jar b/Webview-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.jar
similarity index 100%
rename from Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.jar
rename to Webview-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.jar
diff --git a/Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.properties b/Webview-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.properties
rename to Webview-Screen-Sharing-Java/gradle/wrapper/gradle-wrapper.properties
diff --git a/Screen-Sharing-Java/gradlew b/Webview-Screen-Sharing-Java/gradlew
similarity index 100%
rename from Screen-Sharing-Java/gradlew
rename to Webview-Screen-Sharing-Java/gradlew
diff --git a/Screen-Sharing-Java/gradlew.bat b/Webview-Screen-Sharing-Java/gradlew.bat
similarity index 100%
rename from Screen-Sharing-Java/gradlew.bat
rename to Webview-Screen-Sharing-Java/gradlew.bat
diff --git a/Screen-Sharing-Kotlin/settings.gradle b/Webview-Screen-Sharing-Java/settings.gradle
similarity index 100%
rename from Screen-Sharing-Kotlin/settings.gradle
rename to Webview-Screen-Sharing-Java/settings.gradle
diff --git a/Webview-Screen-Sharing-Kotlin/.gitignore b/Webview-Screen-Sharing-Kotlin/.gitignore
new file mode 100644
index 00000000..93e62f94
--- /dev/null
+++ b/Webview-Screen-Sharing-Kotlin/.gitignore
@@ -0,0 +1,15 @@
+# intellij
+*.iml
+
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+app/build
+
+.settings/
+app/jniLibs/
diff --git a/Screen-Sharing-Kotlin/README.md b/Webview-Screen-Sharing-Kotlin/README.md
similarity index 99%
rename from Screen-Sharing-Kotlin/README.md
rename to Webview-Screen-Sharing-Kotlin/README.md
index 5a2f3306..dae36367 100644
--- a/Screen-Sharing-Kotlin/README.md
+++ b/Webview-Screen-Sharing-Kotlin/README.md
@@ -1,9 +1,9 @@
-# Screen Sharing
+# Webview Screen Sharing
This app shows how to use `WebView` as the source for screen-sharing video.
> Check [Basic-Video-Capturer-Camera-2](../Basic-Video-Capturer-Camera-2) project to see how a device camera can be used as the video source for the custom `Capturer`.
-## Screen sharing
+## Webview Screen sharing
Custom video capturer is using `WebView` from the Android application as the source of
a published stream.
diff --git a/Screen-Sharing-Kotlin/app/.gitignore b/Webview-Screen-Sharing-Kotlin/app/.gitignore
similarity index 100%
rename from Screen-Sharing-Kotlin/app/.gitignore
rename to Webview-Screen-Sharing-Kotlin/app/.gitignore
diff --git a/Screen-Sharing-Kotlin/app/build.gradle b/Webview-Screen-Sharing-Kotlin/app/build.gradle
similarity index 92%
rename from Screen-Sharing-Kotlin/app/build.gradle
rename to Webview-Screen-Sharing-Kotlin/app/build.gradle
index 7f155b6e..12b49037 100644
--- a/Screen-Sharing-Kotlin/app/build.gradle
+++ b/Webview-Screen-Sharing-Kotlin/app/build.gradle
@@ -8,11 +8,11 @@ apply {
}
android {
- namespace "com.tokbox.sample.screensharing"
+ namespace "com.tokbox.sample.webviewscreensharing"
compileSdkVersion extCompileSdkVersion
defaultConfig {
- applicationId "com.tokbox.sample.screensharing"
+ applicationId "com.tokbox.sample.webviewscreensharing"
minSdkVersion extMinSdkVersion
targetSdkVersion extTargetSdkVersion
versionCode extVersionCode
diff --git a/Screen-Sharing-Kotlin/app/src/main/AndroidManifest.xml b/Webview-Screen-Sharing-Kotlin/app/src/main/AndroidManifest.xml
similarity index 95%
rename from Screen-Sharing-Kotlin/app/src/main/AndroidManifest.xml
rename to Webview-Screen-Sharing-Kotlin/app/src/main/AndroidManifest.xml
index 9b370111..0c75d1cb 100644
--- a/Screen-Sharing-Kotlin/app/src/main/AndroidManifest.xml
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="com.tokbox.sample.webviewscreensharing" >
diff --git a/Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/MainActivity.kt b/Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/MainActivity.kt
similarity index 99%
rename from Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/MainActivity.kt
rename to Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/MainActivity.kt
index 65092c6e..a013c06d 100644
--- a/Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/MainActivity.kt
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/MainActivity.kt
@@ -1,4 +1,4 @@
-package com.tokbox.sample.screensharing
+package com.tokbox.sample.webviewscreensharing
import android.Manifest
import android.opengl.GLSurfaceView
diff --git a/Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/OpenTokConfig.kt b/Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/OpenTokConfig.kt
similarity index 96%
rename from Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/OpenTokConfig.kt
rename to Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/OpenTokConfig.kt
index ed46ebb6..21a05309 100644
--- a/Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/OpenTokConfig.kt
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/OpenTokConfig.kt
@@ -1,4 +1,4 @@
-package com.tokbox.sample.screensharing
+package com.tokbox.sample.webviewscreensharing
import android.text.TextUtils
diff --git a/Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/ScreenSharingCapturer.kt b/Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/ScreenSharingCapturer.kt
similarity index 98%
rename from Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/ScreenSharingCapturer.kt
rename to Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/ScreenSharingCapturer.kt
index bd754674..c8640fc2 100644
--- a/Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/screensharing/ScreenSharingCapturer.kt
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/java/com/tokbox/sample/webviewscreensharing/ScreenSharingCapturer.kt
@@ -1,4 +1,4 @@
-package com.tokbox.sample.screensharing
+package com.tokbox.sample.webviewscreensharing
import android.content.Context
import android.graphics.Bitmap
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/layout/activity_main.xml b/Webview-Screen-Sharing-Kotlin/app/src/main/res/layout/activity_main.xml
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/layout/activity_main.xml
rename to Webview-Screen-Sharing-Kotlin/app/src/main/res/layout/activity_main.xml
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..7dd6d427
Binary files /dev/null and b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..b1767f0a
Binary files /dev/null and b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..f284f639
Binary files /dev/null and b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..f277e806
Binary files /dev/null and b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..fa8a5241
Binary files /dev/null and b/Webview-Screen-Sharing-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/values-w820dp/dimens.xml b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 00000000..63fc8164
--- /dev/null
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/colors.xml b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..3ab3e9cb
--- /dev/null
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/dimens.xml b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/dimens.xml
new file mode 100644
index 00000000..47c82246
--- /dev/null
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/values/strings.xml b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/strings.xml
similarity index 83%
rename from Screen-Sharing-Kotlin/app/src/main/res/values/strings.xml
rename to Webview-Screen-Sharing-Kotlin/app/src/main/res/values/strings.xml
index 13f03a21..0e7429e8 100644
--- a/Screen-Sharing-Kotlin/app/src/main/res/values/strings.xml
+++ b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/strings.xml
@@ -1,7 +1,7 @@
- Screen-Sharing
+ Webview-Screen-Sharing
Settings
Permissions Required
diff --git a/Screen-Sharing-Kotlin/app/src/main/res/values/styles.xml b/Webview-Screen-Sharing-Kotlin/app/src/main/res/values/styles.xml
similarity index 100%
rename from Screen-Sharing-Kotlin/app/src/main/res/values/styles.xml
rename to Webview-Screen-Sharing-Kotlin/app/src/main/res/values/styles.xml
diff --git a/Screen-Sharing-Kotlin/build.gradle b/Webview-Screen-Sharing-Kotlin/build.gradle
similarity index 100%
rename from Screen-Sharing-Kotlin/build.gradle
rename to Webview-Screen-Sharing-Kotlin/build.gradle
diff --git a/Webview-Screen-Sharing-Kotlin/gradle.properties b/Webview-Screen-Sharing-Kotlin/gradle.properties
new file mode 100644
index 00000000..a48987c4
--- /dev/null
+++ b/Webview-Screen-Sharing-Kotlin/gradle.properties
@@ -0,0 +1,20 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx4096m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+android.useAndroidX=true
+android.enableJetifier=true
+org.gradle.parallel=true
\ No newline at end of file
diff --git a/Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.jar b/Webview-Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.jar
similarity index 100%
rename from Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.jar
rename to Webview-Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.jar
diff --git a/Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.properties b/Webview-Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.properties
rename to Webview-Screen-Sharing-Kotlin/gradle/wrapper/gradle-wrapper.properties
diff --git a/Screen-Sharing-Kotlin/gradlew b/Webview-Screen-Sharing-Kotlin/gradlew
similarity index 100%
rename from Screen-Sharing-Kotlin/gradlew
rename to Webview-Screen-Sharing-Kotlin/gradlew
diff --git a/Screen-Sharing-Kotlin/gradlew.bat b/Webview-Screen-Sharing-Kotlin/gradlew.bat
similarity index 100%
rename from Screen-Sharing-Kotlin/gradlew.bat
rename to Webview-Screen-Sharing-Kotlin/gradlew.bat
diff --git a/Webview-Screen-Sharing-Kotlin/settings.gradle b/Webview-Screen-Sharing-Kotlin/settings.gradle
new file mode 100644
index 00000000..f60920c6
--- /dev/null
+++ b/Webview-Screen-Sharing-Kotlin/settings.gradle
@@ -0,0 +1,16 @@
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ google()
+ mavenCentral()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+include ':app'