Skip to content

Instantly share code, notes, and snippets.

View omarojo's full-sized avatar

Omar Juarez omarojo

View GitHub Profile
@omarojo
omarojo / Podfile.lock
Created August 9, 2016 22:28
podfile.lock
PODS:
- AppsFlyer-SDK (2.5.3.15.1)
- Bolts (1.6.0):
- Bolts/AppLinks (= 1.6.0)
- Bolts/Tasks (= 1.6.0)
- Bolts/AppLinks (1.6.0):
- Bolts/Tasks
- Bolts/Tasks (1.6.0)
- FBSDKCoreKit (4.7.0):
- Bolts (~> 1.1)
2016-08-11 11:31:14.785 Generate[471:146048] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
2016-08-11 11:31:15.828 Generate[471:146048] Received memory warning.
2016-08-11 11:31:18.595 Generate[471:146048] Welcome
2016-08-11 11:31:19.296 Generate[471:146048] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
2016-08-11 11:31:19.306 Generate[471:146048] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
2016-08-11 11:31:19.308 Generate[471:146048] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
@omarojo
omarojo / gist:934863e6f4ddf4bb3f0de7445da573cd
Last active January 19, 2017 20:58
GPUImage newFrameAvailable
self.rawG8OutputTarget = [[GPUImageRawDataOutput alloc] initWithImageSize: aspectSize resultsInBGRAFormat:YES];
[filterChain.output addTarget:self.rawG8OutputTarget];
__weak GPUImageRawDataOutput *weakRawOutput = self.rawG8OutputTarget;
[self.rawG8OutputTarget setNewFrameAvailableBlock:^{
GLubyte *outputBytes = [weakRawOutput rawBytesForImage];
NSInteger bytesPerRow = [weakRawOutput bytesPerRowInOutput];
//I use this variables to create the image to be streamed.
}];
@omarojo
omarojo / gist:e902fadb1d89de17333466b421bb4887
Last active February 22, 2017 04:56
Facebook GraphRequest empty Alert
let userId = AccessToken.current?.userId
let path = "/"+userId!+"/live_videos"
var title = "the title"
let descript = "my description"
let request : GraphRequest = GraphRequest(graphPath: path,
parameters:["title": title!,
"description": descript,
"privacy":"{'value':'SELF'}",
"save_vod": true,
"fields": ""],
@omarojo
omarojo / imageToPixelBuffer.m
Last active July 11, 2022 08:57
Image to CVPixelBuffer OBJC
let myPixelBuffy = [self pixelBufferFromCGImage:[[UIImage imageNamed:@"myImage.png"] CGImage]];
- (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)image
{
CGSize frameSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image));
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
[NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
nil];
@omarojo
omarojo / imageToPixelBuffer.swift
Created February 23, 2017 23:02
Image To CVPixelBuffer in Swift
var thePixelBuffer : CVPixelBuffer?
let testImage : UIImage = UIImage.init(named: "twdEnds.png")!
self.thePixelBuffer = self.pixelBufferFromImage(image: testImage)
func pixelBufferFromImage(image: UIImage) -> CVPixelBuffer {
@omarojo
omarojo / Polling.swift
Last active May 3, 2017 11:35
Polling with Timer
func startPollingComments(){
if let cStream = currentStream, connected == true{
//the code would not continue if its NOT connected. hence the Timer shcedule will not be generated, this stops the polling
let stream = cStream as! FBLiveStream
stream.getLastComments(completion: { (comments, error) in
if (error == nil){
self.onCommentsUpdate?(comments as! [Dictionary<String, Any>])
}
Timer.scheduledTimer(withTimeInterval: 5.0, repeats: false, block: {timer in
self.startPollingComments()
@omarojo
omarojo / Pause.swift
Created May 4, 2017 10:32
Pause Image for LF Streamer
var pausePixelBuffer = CVPixelBuffer?
func pauseTheStream(){
//Create your Pause Image
createOncePixelBuffer()
//Push your Pause Image into the stream
pushPixelBufferToStream(self.pausePixelBuffer)
//Pause the stream, the video should stop in the last frame, which is your image
rtmpStream.togglePause()
}
@omarojo
omarojo / G8LiveStreamer.swift
Last active May 4, 2017 11:04
LF Custom Live Content
import UIKit
import AVFoundation
import lf
import GPUImage
import VideoToolbox
class G8LiveStreamer: NSObject {
var streamUrl:String?
@omarojo
omarojo / StaticPixelBuffer.swift
Created May 5, 2017 14:53
LF Custom Static Buffer
import lf
import UIKit
import XCGLogger
import AVFoundation
let sampleRate:Double = 44_100
final class LiveViewController: UIViewController {
//.....