Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>I AM REAL</title>
</head>
<body>
<script>
function ready(fn) {
if mediaType == AVMediaTypeVideo, let assetWriterAndInputs = self.newAssetWriterAndInputs {
let sourceTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
assetWriterAndInputs.assetWriter.startSessionAtSourceTime(sourceTime)
self.currentAssetWriterAndInputs = assetWriterAndInputs
self.newAssetWriterAndInputs = nil
}
func timerTick () {
if let newAssetWriter = self.createAssetWriterAndInputs() {
dispatch_async(_writingQueue) {
self.newAssetWriterAndInputs = newAssetWriter;
}
}
}
let sourceTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
assetWriter.startSessionAtSourceTime(sourceTime)
func timerTick () {
if let newAssetWriter = self.createAssetWriterAndInputs() {
dispatch_async(_writingQueue) {
self.currentAssetWriterAndInputs = newAssetWriter
}
}
}