Skip to content

Commit

Permalink
Merge branch 'unoplatform:master' into DevTKSS-docs(CommunityToolkit-…
Browse files Browse the repository at this point in the history
…Converters-update)
  • Loading branch information
DevTKSS authored Dec 14, 2024
2 parents 9292fd5 + cd94b2a commit e4fa1e7
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:

jobs:
analyze:
if: github.repository == 'unoplatform/uno'
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:

jobs:
triage:
if: github.repository == 'unoplatform/uno'
permissions:
contents: read
pull-requests: write
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/no-response.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
noResponse:
if: github.repository == 'unoplatform/uno'
runs-on: ubuntu-latest
steps:
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb # 0.5.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ permissions: read-all

jobs:
analysis:
if: github.repository == 'unoplatform/uno'
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/uwp-autoconvert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:

jobs:
build:
if: github.repository == 'unoplatform/uno'
name: update-uwp-branch
runs-on: windows-latest
steps:
Expand Down
62 changes: 62 additions & 0 deletions doc/articles/features/windows-media-capture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
uid: Uno.Features.Capture
---

# Capture

> [!TIP]
> This article covers Uno-specific information for the `Windows.Media.Capture` namespace. For a full description of the feature and instructions on using it, see [Windows.Media.Capture Namespace](https://learn.microsoft.com/uwp/api/windows.media.capture).
- The `Windows.Media.Capture` namespace provides classes for the capture of photos, audio recordings, and videos.

## `CameraCaptureUI`

`CameraCaptureUI` is currently only supported on Android, iOS, and UWP. On other platforms, `CaptureFile` will return `null`.

### Platform-specific

#### Android

If you are planning to use the `CameraCaptureUI`, your app must declare `android.permission.CAMERA` and `android.permission.WRITE_EXTERNAL_STORAGE` permissions, otherwise the functionality will not work as expected:

```csharp
[assembly: UsesPermission("android.permission.CAMERA")]
[assembly: UsesPermission("android.permission.WRITE_EXTERNAL_STORAGE")]
```

#### iOS

On iOS, `CameraCaptureUI` uses the native UIImagePickerController for capturing media. Ensure that the `NSCameraUsageDescription` and `NSMicrophoneUsageDescription` keys are added to the `Info.plist` file to request the necessary permissions.

#### WinUI/UWP

On UWP, `CameraCaptureUI` provides a unified interface for capturing photos and videos, fully leveraging the platform's APIs. WinUI support is coming with v1.7+.

### Example

```csharp
#if __ANDROID__ || __IOS__ || __WINDOWS__
using Windows.Media.Capture;
#endif

public async Task CapturePhotoAsync()
{
#if __ANDROID__ || __IOS__ || __WINDOWS__
var captureUI = new CameraCaptureUI();
captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;

var file = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);

if (file != null)
{
// Handle the captured file (e.g., save or display it)
}
else
{
// Handle the cancellation or error
}
#endif
}
```

You can also check out our [sample](https://github.com/unoplatform/Uno.Samples/tree/master/UI/CameraCaptureUI) for more details.
2 changes: 2 additions & 0 deletions doc/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@
href: features/windows-system-power.md
- name: Bluetooth
href: features/bluetoothdevice.md
- name: Capture (Camera)
href: features/windows-media-capture.md
- name: Clipboard
href: features/clipboard.md
- name: Compass
Expand Down

0 comments on commit e4fa1e7

Please sign in to comment.