Feel Physics Backyard

HoloLensの出張授業をする会社で、教材を開発しています

アプリの画面を動画として保存する 罠だらけ(iOS9)

f:id:weed_7777:20160930172541p:plain

ゲームのプレイ動画を保存するなどの目的でiOS9からはReplayKitというフレームワークが加わっています。一見、これを使えば簡単そうですが、やってみると実際にはスレッド制御などが必要など、罠だらけです。

ReplayKit Framework has added from iOS9 for the purpose of saving the game play video. At first glance, it is simple enough, but if you use this, in fact, be full of traps, such as the need of thread control.

続きを読む

Swift Playgroundsに貼り付けるだけで確かめるAVFoundation(iOS9)

f:id:weed_7777:20160929140033j:plain

AVFoundationの勉強で、テキストの読み上げをさせてみました。以下のコードをSwift Playgroundに貼り付けるだけで動きます。ちなみにiPadのSwift Playgroundsに貼り付けても動きません。どうも文読み上げの辞書がアプリに入っていないようです。

//: Playground - noun: a place where people can play

import XCPlayground
XCPSetExecutionShouldContinueIndefinitely(true)

import AVFoundation

class THSpeechController{
    var synthesizer: AVSpeechSynthesizer
    var voices: [AVSpeechSynthesisVoice]
    var speechStrings: [String]
    
    init () {
        self.synthesizer = AVSpeechSynthesizer()
        self.voices = [
            AVSpeechSynthesisVoice(language: "en-US")!,
            AVSpeechSynthesisVoice(language: "en-GB")!]

        func buildSpeechStrings() -> [String] {
            return ["Hello AV Foundation. How are you?",
                    "I'm well! Thanks for asking."]
        }
        
        self.speechStrings = buildSpeechStrings()
    }
    
    func beginConversation() -> Void {
        let num = self.speechStrings.count
        for i in 0..<num {
            let utterance   = AVSpeechUtterance(string: speechStrings[i])
            utterance.voice = self.voices[i % 2]
            utterance.rate               = 0.4
            utterance.pitchMultiplier    = 0.8
            utterance.postUtteranceDelay = 0.1
            self.synthesizer.speakUtterance(utterance)
        }
    }
}

let sc = THSpeechController()
sc.beginConversation()

実は月とスッポン クラウドストレージ3つの検索速度の比較

f:id:weed_7777:20160902100127p:plain

スマホクラウドストレージ(PCはなし)の時代が来つつある。しかし、スマホからクラウドストレージ(Dropbox)上のファイルを探すとき、検索が遅いのが私は不満だった。そこで、実際に3つのサービスで実験をした。

続きを読む

iPhoneだけでTumblrに画像付き引用投稿する

f:id:weed_7777:20160722171031p:plain

iPhoneTumblr拡張でWebページをクリップするとき、画像を付けることはできません。そのため、文字だけというイマイチな感じの記事になってしまいます。そこでクリップしたページに画像を付ける方法を説明します。

続きを読む