This file contains 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
func exportVideoWithWatermark(inputURL: URL, outputURL: URL, watermark: UIImage) { | |
guard let composition = addWatermark(to: inputURL, watermark: watermark) else { | |
print("Failed to add watermark") | |
return | |
} | |
guard let exportSession = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetHighestQuality) else { | |
print("Failed to create export session") | |
return | |
} |
This file contains 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
import AVFoundation | |
func addWatermark(to videoURL: URL, watermark: UIImage) -> AVMutableComposition? { | |
// Create a new mutable composition | |
let mixComposition = AVMutableComposition() | |
// Add a new mutable track to the composition and get the first video track from the asset | |
guard let track = mixComposition.addMutableTrack(withMediaType: .video, preferredTrackID: Int32(kCMPersistentTrackID_Invalid)), | |
let asset = AVAsset(url: videoURL).tracks(withMediaType: .video).first else { | |
return nil |
This file contains 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
if let navigationBar = navigationBar as? UINavigationBar { | |
navigationBar.titleTextAttributes = [NSAttributedString.Key.font: UIFont.ok_bold(20)] | |
} |
This file contains 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
.h file declarations | |
@property (strong, nonatomic) UINavigationController *navigationController; | |
.m app delegate implementation | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
self.navigationController = [[UINavigationController alloc] init]; | |
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; | |
[self.navigationController pushViewController:self.viewController animated:YES]; | |
// Override point for customization after application launch. |
This file contains 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
struct PostContent: Codable { | |
struct Paragraph: Codable { | |
let id: String | |
let text: String | |
} | |
struct Section: Codable { | |
let id: String | |
let startIndex: Int | |
} | |
var paragraphs: [Paragraph] |
This file contains 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
{ | |
"paragraphs": [{ | |
"id": "p0", | |
"text": "aaa" | |
}, | |
{ | |
"id": "p1", | |
"text": "bbb" | |
}, | |
{ |
This file contains 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
#ifdef _MSC_VER | |
// windows OS | |
# define BREAK_HERE() __debugbreak() | |
#elif defined(ARCH_X64) || defined(ARCH_X86) | |
// linux or iOS based systems | |
# define BREAK_HERE() __asm__("int $3") | |
#else | |
# define BREAK_HERE() raise(SIGTRAP) | |
#endif |
This file contains 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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
enum Maps : Int { | |
case google = 1 | |
case apple | |
} |
This file contains 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
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let html = """ | |
<html> | |
<body> | |
<p style="color: blue; | |
font-size: 20px; | |
"> |
This file contains 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
/Users/darshan/Downloads/ffmpeg -filter:v idet -frames:v 100 -an -f rawvideo -y /dev/null -i /Users/darshan/Dropbox/Public/1080i/interlaced/Mug\ Drop_Interlaced_4ss.mp4 | |
video:303750kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000% | |
[Parsed_idet_0 @ 0x7facaf200000] Repeated Fields: Neither: 63 Top: 20 Bottom: 18 | |
[Parsed_idet_0 @ 0x7facaf200000] Single frame detection: TFF: 81 BFF: 0 Progressive: 20 Undetermined: 0 | |
[Parsed_idet_0 @ 0x7facaf200000] Multi frame detection: TFF: 101 BFF: 0 Progressive: 0 Undetermined: 0 |
NewerOlder