Skip to content

Commit

Permalink
Merge pull request #743 from bobek-balinek/feature/visionOS
Browse files Browse the repository at this point in the history
Add support for visionOS
  • Loading branch information
kean authored Jan 6, 2024
2 parents 1694798 + 342cb72 commit 37740d2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
25 changes: 25 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version:5.9
import PackageDescription

let package = Package(
name: "Nuke",
platforms: [
.iOS(.v13),
.tvOS(.v13),
.macOS(.v10_15),
.watchOS(.v6),
.visionOS(.v1),
],
products: [
.library(name: "Nuke", targets: ["Nuke"]),
.library(name: "NukeUI", targets: ["NukeUI"]),
.library(name: "NukeVideo", targets: ["NukeVideo"]),
.library(name: "NukeExtensions", targets: ["NukeExtensions"])
],
targets: [
.target(name: "Nuke"),
.target(name: "NukeUI", dependencies: ["Nuke"]),
.target(name: "NukeVideo", dependencies: ["Nuke"]),
.target(name: "NukeExtensions", dependencies: ["Nuke"])
]
)
2 changes: 1 addition & 1 deletion Sources/NukeVideo/ImageDecoders+Video.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Copyright (c) 2015-2023 Alexander Grebenyuk (github.com/kean).

#if !os(watchOS)
#if !os(watchOS) && !os(visionOS)

import Foundation
import AVKit
Expand Down
6 changes: 5 additions & 1 deletion Sources/NukeVideo/VideoPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ public final class VideoPlayerView: _PlatformBaseView {
let playerItem = AVPlayerItem(asset: asset)
let player = AVQueuePlayer(playerItem: playerItem)
player.isMuted = true
player.preventsDisplaySleepDuringVideoPlayback = false
#if os(visionOS)
player.preventsAutomaticBackgroundingDuringVideoPlayback = false
#else
player.preventsDisplaySleepDuringVideoPlayback = false
#endif
player.actionAtItemEnd = isLooping ? .none : .pause
self.player = player

Expand Down

0 comments on commit 37740d2

Please sign in to comment.