This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright 2013 Evelio Tarazona Cáceres <evelio@evelio.info> | |
| * | |
| * 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 | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ git clone https://github.com/iizukanao/node-rtsp-rtmp-server | |
| $ coffee -c . | |
| $ node server.js | |
| $ ffmpeg -f avfoundation -i "0" -vcodec libx264 -tune zerolatency -s 320x480 -vf crop=320:480:0:0 -f flv rtmp://0.0.0.0/live/desktop | |
| # stream on ios device | |
| $ git clone https://github.com/iMoreApps/ffmpeg-avplayer-for-ios-tvos | |
| $ open AVPlayerDemo.xcodeproj (change rtmp stream to rtmp://<LOCAL_IP>/live/desktop, build and run) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hashlearn.common.utils; | |
| import android.graphics.Canvas; | |
| import android.graphics.Paint; | |
| import android.graphics.Rect; | |
| import android.graphics.drawable.Drawable; | |
| import android.text.style.DynamicDrawableSpan; | |
| import java.lang.ref.WeakReference; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AccountAuthenticator extends AbstractAccountAuthenticator { | |
| private final Context context; | |
| @Inject @ClientId String clientId; | |
| @Inject @ClientSecret String clientSecret; | |
| @Inject ApiService apiService; | |
| public AccountAuthenticator(Context context) { | |
| super(context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- ... --> | |
| <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | |
| <uses-permission android:name="android.permission.INTERNET" /> | |
| <uses-permission android:name="android.permission.USE_CREDENTIALS" /> | |
| <!-- ... --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val handler = Handler() | |
| window.addOnFrameMetricsAvailableListener( | |
| { _, frameMetrics, _ -> | |
| val frameMetricsCopy = FrameMetrics(frameMetrics) | |
| // Layout measure duration in nanoseconds | |
| val layoutMeasureDurationNs = | |
| frameMetricsCopy.getMetric(FrameMetrics.LAYOUT_MEASURE_DURATION) | |
| Timber.d("LAYOUT_MEASURE_DURATION: %s", | |
| (layoutMeasureDurationNs / Math.pow(10.0, 6.0)).toString()) | |
| }, handler) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Override in your touch-enabled view (this can be differen than the view you use for displaying the cam preview) | |
| @Override | |
| public boolean onTouch(View view, MotionEvent motionEvent) { | |
| final int actionMasked = motionEvent.getActionMasked(); | |
| if (actionMasked != MotionEvent.ACTION_DOWN) { | |
| return false; | |
| } | |
| if (mManualFocusEngaged) { | |
| Log.d(TAG, "Manual focus already engaged"); | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static int getMaxCodecInstanceByName(String name) { | |
| final Vector<MediaCodec> codecs = new Vector<>(); | |
| final MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, 1920, 1080); | |
| MediaCodec codec = null; | |
| for (int i = 0; i < max; i++) { | |
| try { | |
| codec = MediaCodec.createDecoderByType(MediaFormat.MIMETYPE_VIDEO_AVC); | |
| codec.configure(format, null, null, 0); | |
| codec.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DemoModeEnabler { | |
| fun enable() { | |
| executeShellCommand("settings put global sysui_demo_allowed 1") | |
| sendCommand("exit") | |
| sendCommand("enter") | |
| sendCommand("notifications", "visible" to "false") | |
| sendCommand("network", "wifi" to "hide") | |
| sendCommand("battery", "level" to "100", "plugged" to "false") | |
| sendCommand("clock", "hhmm" to "1000") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright (C) 2017 The Android Open Source Project | |
| * | |
| * 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 | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |