Skip to content

Commit

Permalink
root: Add Bezel promo blocks to all blogs
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-cain13 committed May 24, 2024
1 parent 5bdd54c commit 81e23e5
Show file tree
Hide file tree
Showing 17 changed files with 527 additions and 3 deletions.
32 changes: 32 additions & 0 deletions root/Content/blog/2023-01-29-recording-avcapturescreeninput.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ featured: true
**tldr; Create an AVCaptureSession, connect the AVCaptureScreenInput and a AVCaptureMovieFileOutput.**

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=recording-to-disk-with-avcapturescreeninput" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## Recording to a file

In our recent project to build a new recording backend for [Screen Studio](https://screenstudio.lemonsqueezy.com?aff=nXV1B), we needed to create a screen recording on macOS and write the output to a file on disk. For newer macOS versions, we use ScreenCaptureKit, but that has only been available since macOS 12.3, and we also wanted to support 10.15 Catalina.
Expand Down Expand Up @@ -76,6 +92,22 @@ To run this, clone the repo and run:
swift run avcrecording
```

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=recording-to-disk-with-avcapturescreeninput" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## References

- Nonstrict. (2023, January 24). AVCaptureScreenInput Recording Example. GitHub. [https://github.com/nonstrict-hq/AVCaptureScreenInput-Recording-example](https://github.com/nonstrict-hq/AVCaptureScreenInput-Recording-example)
Expand Down
32 changes: 32 additions & 0 deletions root/Content/blog/2023-01-30-async-older-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ featured: true

***tl;dr You need to ship `libswift_Concurrency.dylib` along with your CLI executable on macOS 10.15 and macOS 11, put it in `../lib` relative to your executable. You can add an rpath if you want a more convenient location (see blogpost).***

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=using-async-await-in-a-commandline-tool-on-older-macos-versions" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## Building a commandline tool with async/await

Swift concurrency seemed like a great fit for the new recorder backend for [Screen Studio](https://screenstudio.lemonsqueezy.com?aff=nXV1B) we built recently. It captures multiple devices in sync and features like async/await and task groups would help to write clear code that also executes in parallel where possible. The recorder is implemented as a macOS commandline tool that gets called from the Electron app and uses system native APIs to capture data from different devices.
Expand Down Expand Up @@ -124,6 +140,22 @@ Since we’re embedding the commandline tool into an Electron app shipping dynam

After some more contact with Apple DTS it turns out it's important that you put everything in the right folder when shipping the binary as a helper app. As described in the [Placing Content in a Bundle](https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle?language=objc) article from Apple, the binary should be in the `Contents/Helpers/` folder and the dynamic library in the `Contents/Frameworks/` folder. This helps to avoid code signing issues. We added another unsafe flag to the linker settings to `@executable_path/../Frameworks` to solve this.

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=using-async-await-in-a-commandline-tool-on-older-macos-versions" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## References

- Nonstrict. (2023, January 24). Concurrency CLI Sample. GitHub. [https://github.com/nonstrict-hq/concurrency-cli-sample](https://github.com/nonstrict-hq/concurrency-cli-sample)
Expand Down
32 changes: 32 additions & 0 deletions root/Content/blog/2023-01-31-recording-screencapturekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ featured: true
**tldr; Use an AVAssetWriter to save CMSampleBuffers in a SCStreamOutput callback. See our GitHub for a detailed example.**

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=recording-to-disk-with-screencapturekit" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## Recording to a file

ScreenCaptureKit is awesome, it allows for many custom filters to only capture specific content, and it is very efficient. In our recent project to build a new recording backend for [Screen Studio](https://screenstudio.lemonsqueezy.com?aff=nXV1B), we needed to create a screen recording on macOS and write the output to a file on disk.
Expand Down Expand Up @@ -203,6 +219,22 @@ To run this, clone the repo and run:
swift run sckrecording
```

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=recording-to-disk-with-screencapturekit" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## References

- Nonstrict. (2023, January 24). ScreenCaptureKit Recording Example. GitHub. [https://github.com/nonstrict-hq/ScreenCaptureKit-Recording-example](https://github.com/nonstrict-hq/ScreenCaptureKit-Recording-sample)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ The SCStreamError type and related error codes don't have `@availability` annota

Even using these types from within an `@available` scope won't work, as a workaround you can hardcode the error domain and codes raw values.

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=mentioning-scstreamerror-crashes-on-older-macos-versions" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## Demonstrating the issue

If you have an app that uses these types, it will work as expected on macOS 12.3+, but will crash on previous macOS versions.
Expand Down Expand Up @@ -62,3 +78,19 @@ do {
## Feedback Assistant

This issue was submitted to Apple as FB12052574, a demonstration project can be found on our GitHub: [https://github.com/nonstrict-hq/scstreamerror-sample](https://github.com/nonstrict-hq/scstreamerror-sample).

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=mentioning-scstreamerror-crashes-on-older-macos-versions" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ Since macOS 11 and iOS 14 `AVAssetWriter` is able to write CMAF compliant segmen

Often media is converted into segments ahead of time, but generating segments in realtime can also be useful. For example to streaming upload a recording to a server or to directly make an unfinished stream available for consumers in a replayable way.

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=avassetwriter-crash-when-using-CMAF" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## It crashes on Intel

When we created CMAF compliant fMP4 segments using AVAssetWriter from a screen recording we noticed it crashed consistently after a few seconds for a select group of users. They all had the following error:
Expand Down Expand Up @@ -44,6 +60,22 @@ Breaking any of the above 4 conditions will prevent the crash. The most feasible

This issue was submitted to Apple as FB12057159. We also created a [demonstration project for this issue on GitHub](https://github.com/nonstrict-hq/realtime-cmaf-crash-sample).

<div class="not-prose flex space-x-4 border-2 border-orange-500 rounded-lg pl-4 pr-6 py-6 mt-8 -mb-6">
<div class="flex-initial">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=avassetwriter-crash-when-using-CMAF" target="_blank"><img src="/images/bezel-icon.png" class="max-h-full max-w-10 m-0"></a>
</div>
<div class="flex-initial">
<h3 class="text-2xl font-bold text-black hover:text-orange-500 leading-relaxed mt-0 mb-2"><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">Bezel · Mirror your iPhone on your Mac</a></h3>
<p class="mb-2">Perfect for app demos & presentations; Simply plug in an iPhone and it automatically shows up on your Mac.</p>
<p><a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank" class="text-orange hover:text-orange-500 underline font-medium">Learn more →</a></p>
</div>
<div class="flex-initial hidden md:block">
<a href="/bezel?utm_source=nonstrict&utm_medium=blog&utm_content=hkworkoutsession-remote-delegate-not-setup-error" target="_blank">
<img src="/images/bezel-still.jpg" class="max-h-full max-w-36 rounded-md bg-white/5 ring-1 ring-gray-600/50 dark:ring-white/50 lg:mt-auto">
</a>
</div>
</div>

## References

Nonstrict. (2023, March 13). Realtime CMAF crash sample. GitHub. [https://github.com/nonstrict-hq/realtime-cmaf-crash-sample](https://github.com/nonstrict-hq/realtime-cmaf-crash-sample)
- Nonstrict. (2023, March 13). Realtime CMAF crash sample. GitHub. [https://github.com/nonstrict-hq/realtime-cmaf-crash-sample](https://github.com/nonstrict-hq/realtime-cmaf-crash-sample)
Loading

0 comments on commit 81e23e5

Please sign in to comment.