-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97135fe
commit 8df5bd5
Showing
6 changed files
with
116 additions
and
51 deletions.
There are no files selected for viewing
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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
AppliverySDK/Applivery/Modules/Screenshoot/Views/ViedeoPlayerView.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// ViedeoPlayerView.swift | ||
// | ||
// | ||
// Created by Fran Alarza on 13/9/24. | ||
// | ||
|
||
import SwiftUI | ||
import AVKit | ||
import AVFoundation | ||
|
||
struct ViedeoPlayerView: View { | ||
@Environment(\.dismiss) var dismiss | ||
let videoURL: URL | ||
|
||
var body: some View { | ||
VideoPlayerViewRepresentable(videoURL: videoURL) | ||
.edgesIgnoringSafeArea(.all) | ||
} | ||
} | ||
|
||
#Preview { | ||
ViedeoPlayerView(videoURL: URL(string: "https://www.example.com/video.mp4")!) | ||
} | ||
|
||
struct VideoPlayerViewRepresentable: UIViewControllerRepresentable { | ||
|
||
var videoURL: URL | ||
|
||
func makeUIViewController(context: Context) -> AVPlayerViewController { | ||
let playerViewController = AVPlayerViewController() | ||
let player = AVPlayer(url: videoURL) | ||
playerViewController.player = player | ||
player.play() | ||
return playerViewController | ||
} | ||
|
||
func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) { | ||
// No se necesita actualizar nada | ||
} | ||
} |