Index: webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py |
diff --git a/webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py b/webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c5c8da6e42b7ce82233e3769ac4d6ecda70dc50b |
--- /dev/null |
+++ b/webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py |
@@ -0,0 +1,57 @@ |
+# Copyright 2016 The WebRTC Project Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license |
+# that can be found in the LICENSE file in the root of the source |
+# tree. An additional intellectual property rights grant can be found |
+# in the file PATENTS. All contributing project authors may |
+# be found in the AUTHORS file in the root of the source tree. |
+from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice |
+ |
+import string |
+import time |
+import random |
+import sys |
+import subprocess |
+ |
+devname = sys.argv[2] |
+ |
+videoout = sys.argv[3] |
+ |
+room = ''.join(random.choice(string.ascii_letters + string.digits) |
+ for _ in range(8)) |
+ |
+# Delete output video file |
+subprocess.Popen(['adb', '-s', devname, 'shell', 'rm', |
+ '/storage/emulated/0/output.y4m']) |
+#sys.exit() |
+ |
+device = MonkeyRunner.waitForConnection(2, devname) |
+ |
+extras = { |
+ 'org.appspot.apprtc.AUDIOCODEC': 'OPUS', |
+ 'org.appspot.apprtc.LOOPBACK': True, |
+ 'org.appspot.apprtc.VIDEOCODEC': 'VP8', |
+ 'org.appspot.apprtc.CAPTURETOTEXTURE': False, |
+ 'org.appspot.apprtc.CAMERA2': False, |
+ 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA': |
+ '/storage/emulated/0/nv21_1280x720.yuv', |
+ 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_WIDTH': 1280, |
+ 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_HEIGHT': 720, |
+ 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE': |
+ '/storage/emulated/0/output.y4m', |
+ 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH': 1280, |
+ 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT': 720, |
+ 'org.appspot.apprtc.ROOMID': room} |
+ |
+# ACTION_VIEW is equivalent to android.intent.action.VIEW, |
+# see https://developer.android.com/reference/android/content/Intent.html#ACTION_VIEW |
+device.startActivity(data='https://appr.tc', action='ACTION_VIEW', |
+ component='org.appspot.apprtc/.CallActivity', extras=extras) |
+ |
+time.sleep(10) |
+ |
+# Press back to end the call. Will end on both sides |
+device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP) |
+ |
+subprocess.Popen(['adb', '-s', devname, 'pull', |
+ '/storage/emulated/0/output.y4m', videoout]) |
+ |