Skip to content

Instantly share code, notes, and snippets.

#import "UIView+LKViewUtil.h"
#import "LKMacro.h"
#import <QuartzCore/QuartzCore.h>
@implementation UIView (LKViewUtil)
- (void)centerizeInRect:(CGRect)rect
{
self.frame = CGRectMake((rect.size.width - self.frame.size.width)/2.0,
(rect.size.height - self.frame.size.height)/2.0,
@lyokato
lyokato / LockScreen.scpt
Created November 22, 2016 02:49
LockScreen AppleScript
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"
my lockscrn()
on lockscrn()
set bundle to current application's NSBundle's bundleWithPath:"/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu/"
bundle's load
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"
on run {input, parameters}
set bundle to current application's NSBundle's bundleWithPath:"/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu/"
bundle's load
@lyokato
lyokato / build_aar.py
Created March 27, 2017 08:53
src/tools-webrtc/android/build_aar.py patched for arm64-v8a
#!/usr/bin/env python
# Copyright (c) 2017 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.
@lyokato
lyokato / MyVideoSourceFilter.m
Created June 12, 2017 15:09
WebRTC iOS SDK用 Video Source Filter 実装例1
@interface MyVideoSourceFilter : NSObject<RTCVideoCapturerDelegate>
- (instancetype)initWithSource:(RTCVideoSource *)source;
@end
@implementation MyVideoSourceFilter
- (instancetype)initWithSource:(RTCVideoSource *)source {
if (self = [super init]) {
self.source = source;
}
return self;
@lyokato
lyokato / WebRTCLocalVideoExample.m
Created June 12, 2017 15:11
WebRTC Loal Video Setup Example (without filter)
// ...
RTCVideoSource *source = [factory videoSource];
RTCVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];
RTCVideoTrack *trakc = [factory videoTrackWithSource:source trackId:trackId];
// ...
@lyokato
lyokato / WebRTCLocalVideoExample2.m
Created June 12, 2017 15:13
WebRTC Local Video Setup With Filter
RTCVideoSource *source = [factory videoSource];
// VideoSourceからFilterを準備し
MyVideoSourceFilter *filter = [[MyVideoSourceFilter alloc] initWithSource:source];
// Capturerには、Filterを渡す
RTCVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:filter];
RTCVideoTrack *trakc = [factory videoTrackWithSource:source trackId:trackId];
@lyokato
lyokato / WebRTCFilterExample.m
Created June 12, 2017 15:35
WebRTC Filter Example
- (instancetype)initWithSource:(RTCVideoSource *)source {
if (self = [super init]) {
self.source = source;
// CI ContextとColorSpaceを準備しておく
self.context =
[CIContext contextWithOptions:@{kCIContextUseSoftwareRenderer: @NO}];
_colorSpace = CGColorSpaceCreateDeviceRGB();
self.filters = @[].mutableCopy;
}
bool PeerConnection::AddStream(MediaStreamInterface* local_stream) {
TRACE_EVENT0("webrtc", "PeerConnection::AddStream");
if (IsClosed()) {
return false;
}
if (!CanAddLocalMediaStream(local_streams_, local_stream)) {
return false;
}
local_streams_->AddStream(local_stream);
private var channelListener: SoraAudioChannel.Listener = object : SoraAudioChannel.Listener {
override fun onConnect(channel: SoraAudioChannel) {
ui?.changeStateText("CONNECTED")
}
override fun onClose(channel: SoraAudioChannel) {
ui?.changeStateText("CLOSED")
close()