Move duplicate objects in both Video Players to a shared file
This commit is contained in:
parent
21c4fa29c1
commit
f05eee3593
|
@ -11,24 +11,6 @@ import MediaPlayer
|
||||||
import JellyfinAPI
|
import JellyfinAPI
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
struct Subtitle {
|
|
||||||
var name: String
|
|
||||||
var id: Int32
|
|
||||||
var url: URL?
|
|
||||||
var delivery: SubtitleDeliveryMethod
|
|
||||||
var codec: String
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AudioTrack {
|
|
||||||
var name: String
|
|
||||||
var id: Int32
|
|
||||||
}
|
|
||||||
|
|
||||||
class PlaybackItem: ObservableObject {
|
|
||||||
@Published var videoType: PlayMethod = .directPlay
|
|
||||||
@Published var videoUrl: URL = URL(string: "https://example.com")!
|
|
||||||
}
|
|
||||||
|
|
||||||
protocol VideoPlayerSettingsDelegate: AnyObject {
|
protocol VideoPlayerSettingsDelegate: AnyObject {
|
||||||
func selectNew(audioTrack id: Int32)
|
func selectNew(audioTrack id: Int32)
|
||||||
func selectNew(subtitleTrack id: Int32)
|
func selectNew(subtitleTrack id: Int32)
|
||||||
|
@ -167,7 +149,6 @@ class VideoPlayerViewController: UIViewController, VideoPlayerSettingsDelegate,
|
||||||
let playbackInfo = PlaybackInfoDto(userId: SessionManager.current.user.user_id!, maxStreamingBitrate: Int(maxBitrate), startTimeTicks: manifest.userData?.playbackPositionTicks ?? 0, deviceProfile: profile, autoOpenLiveStream: true)
|
let playbackInfo = PlaybackInfoDto(userId: SessionManager.current.user.user_id!, maxStreamingBitrate: Int(maxBitrate), startTimeTicks: manifest.userData?.playbackPositionTicks ?? 0, deviceProfile: profile, autoOpenLiveStream: true)
|
||||||
|
|
||||||
DispatchQueue.global(qos: .userInitiated).async { [self] in
|
DispatchQueue.global(qos: .userInitiated).async { [self] in
|
||||||
// delegate?.showLoadingView(self)
|
|
||||||
MediaInfoAPI.getPostedPlaybackInfo(itemId: manifest.id!, userId: SessionManager.current.user.user_id!, maxStreamingBitrate: Int(maxBitrate), startTimeTicks: manifest.userData?.playbackPositionTicks ?? 0, autoOpenLiveStream: true, playbackInfoDto: playbackInfo)
|
MediaInfoAPI.getPostedPlaybackInfo(itemId: manifest.id!, userId: SessionManager.current.user.user_id!, maxStreamingBitrate: Int(maxBitrate), startTimeTicks: manifest.userData?.playbackPositionTicks ?? 0, autoOpenLiveStream: true, playbackInfoDto: playbackInfo)
|
||||||
.sink(receiveCompletion: { result in
|
.sink(receiveCompletion: { result in
|
||||||
print(result)
|
print(result)
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
09389CC326814DF600AE350E /* VideoPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09389CBC26814DF600AE350E /* VideoPlayerViewController.swift */; };
|
09389CC326814DF600AE350E /* VideoPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09389CBC26814DF600AE350E /* VideoPlayerViewController.swift */; };
|
||||||
09389CC426814DF600AE350E /* AudioView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09389CBD26814DF600AE350E /* AudioView.swift */; };
|
09389CC426814DF600AE350E /* AudioView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09389CBD26814DF600AE350E /* AudioView.swift */; };
|
||||||
09389CC526814E4500AE350E /* DeviceProfileBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53192D5C265AA78A008A4215 /* DeviceProfileBuilder.swift */; };
|
09389CC526814E4500AE350E /* DeviceProfileBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53192D5C265AA78A008A4215 /* DeviceProfileBuilder.swift */; };
|
||||||
|
09389CC726819B4600AE350E /* VideoPlayerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09389CC626819B4500AE350E /* VideoPlayerModel.swift */; };
|
||||||
|
09389CC826819B4600AE350E /* VideoPlayerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09389CC626819B4500AE350E /* VideoPlayerModel.swift */; };
|
||||||
531690E5267ABD5C005D8AB9 /* MainTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531690E4267ABD5C005D8AB9 /* MainTabView.swift */; };
|
531690E5267ABD5C005D8AB9 /* MainTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531690E4267ABD5C005D8AB9 /* MainTabView.swift */; };
|
||||||
531690E7267ABD79005D8AB9 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531690E6267ABD79005D8AB9 /* HomeView.swift */; };
|
531690E7267ABD79005D8AB9 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531690E6267ABD79005D8AB9 /* HomeView.swift */; };
|
||||||
531690ED267ABF46005D8AB9 /* ContinueWatchingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531690EB267ABF46005D8AB9 /* ContinueWatchingView.swift */; };
|
531690ED267ABF46005D8AB9 /* ContinueWatchingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531690EB267ABF46005D8AB9 /* ContinueWatchingView.swift */; };
|
||||||
|
@ -196,6 +198,7 @@
|
||||||
09389CBB26814DF600AE350E /* VideoPlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayer.swift; sourceTree = "<group>"; };
|
09389CBB26814DF600AE350E /* VideoPlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayer.swift; sourceTree = "<group>"; };
|
||||||
09389CBC26814DF600AE350E /* VideoPlayerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerViewController.swift; sourceTree = "<group>"; };
|
09389CBC26814DF600AE350E /* VideoPlayerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerViewController.swift; sourceTree = "<group>"; };
|
||||||
09389CBD26814DF600AE350E /* AudioView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioView.swift; sourceTree = "<group>"; };
|
09389CBD26814DF600AE350E /* AudioView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioView.swift; sourceTree = "<group>"; };
|
||||||
|
09389CC626819B4500AE350E /* VideoPlayerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPlayerModel.swift; sourceTree = "<group>"; };
|
||||||
3773C07648173CE7FEC083D5 /* Pods-JellyfinPlayer iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JellyfinPlayer iOS.debug.xcconfig"; path = "Target Support Files/Pods-JellyfinPlayer iOS/Pods-JellyfinPlayer iOS.debug.xcconfig"; sourceTree = "<group>"; };
|
3773C07648173CE7FEC083D5 /* Pods-JellyfinPlayer iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JellyfinPlayer iOS.debug.xcconfig"; path = "Target Support Files/Pods-JellyfinPlayer iOS/Pods-JellyfinPlayer iOS.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
3F905C1D3D3A0C9E13E7A0BC /* Pods_JellyfinPlayer_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JellyfinPlayer_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
3F905C1D3D3A0C9E13E7A0BC /* Pods_JellyfinPlayer_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JellyfinPlayer_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
531690E4267ABD5C005D8AB9 /* MainTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabView.swift; sourceTree = "<group>"; };
|
531690E4267ABD5C005D8AB9 /* MainTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabView.swift; sourceTree = "<group>"; };
|
||||||
|
@ -393,6 +396,7 @@
|
||||||
62E632EB267D410B0063E547 /* SeriesItemViewModel.swift */,
|
62E632EB267D410B0063E547 /* SeriesItemViewModel.swift */,
|
||||||
62E632EE267D43320063E547 /* LibraryFilterViewModel.swift */,
|
62E632EE267D43320063E547 /* LibraryFilterViewModel.swift */,
|
||||||
62E632F2267D54030063E547 /* DetailItemViewModel.swift */,
|
62E632F2267D54030063E547 /* DetailItemViewModel.swift */,
|
||||||
|
09389CC626819B4500AE350E /* VideoPlayerModel.swift */,
|
||||||
);
|
);
|
||||||
path = ViewModels;
|
path = ViewModels;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -939,6 +943,7 @@
|
||||||
531690FA267AD6EC005D8AB9 /* PlainNavigationLinkButton.swift in Sources */,
|
531690FA267AD6EC005D8AB9 /* PlainNavigationLinkButton.swift in Sources */,
|
||||||
535870A32669D89F00D05A09 /* Model.xcdatamodeld in Sources */,
|
535870A32669D89F00D05A09 /* Model.xcdatamodeld in Sources */,
|
||||||
09389CC426814DF600AE350E /* AudioView.swift in Sources */,
|
09389CC426814DF600AE350E /* AudioView.swift in Sources */,
|
||||||
|
09389CC826819B4600AE350E /* VideoPlayerModel.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -995,6 +1000,7 @@
|
||||||
625CB56C2678C0FD00530A6E /* MainTabView.swift in Sources */,
|
625CB56C2678C0FD00530A6E /* MainTabView.swift in Sources */,
|
||||||
539B2DA5263BA5B8007FF1A4 /* SettingsView.swift in Sources */,
|
539B2DA5263BA5B8007FF1A4 /* SettingsView.swift in Sources */,
|
||||||
5338F74E263B61370014BF09 /* ConnectToServerView.swift in Sources */,
|
5338F74E263B61370014BF09 /* ConnectToServerView.swift in Sources */,
|
||||||
|
09389CC726819B4600AE350E /* VideoPlayerModel.swift in Sources */,
|
||||||
53AD124D267029D60094A276 /* SeriesItemView.swift in Sources */,
|
53AD124D267029D60094A276 /* SeriesItemView.swift in Sources */,
|
||||||
5377CBF5263B596A003A4E83 /* JellyfinPlayerApp.swift in Sources */,
|
5377CBF5263B596A003A4E83 /* JellyfinPlayerApp.swift in Sources */,
|
||||||
53EE24E6265060780068F029 /* LibrarySearchView.swift in Sources */,
|
53EE24E6265060780068F029 /* LibrarySearchView.swift in Sources */,
|
||||||
|
|
|
@ -13,29 +13,12 @@ import Combine
|
||||||
import GoogleCast
|
import GoogleCast
|
||||||
import SwiftyJSON
|
import SwiftyJSON
|
||||||
|
|
||||||
struct Subtitle {
|
|
||||||
var name: String
|
|
||||||
var id: Int32
|
|
||||||
var url: URL?
|
|
||||||
var delivery: SubtitleDeliveryMethod
|
|
||||||
var codec: String
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AudioTrack {
|
|
||||||
var name: String
|
|
||||||
var id: Int32
|
|
||||||
}
|
|
||||||
|
|
||||||
enum PlayerDestination {
|
enum PlayerDestination {
|
||||||
case remote
|
case remote
|
||||||
case local
|
case local
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlaybackItem: ObservableObject {
|
|
||||||
@Published var videoType: PlayMethod = .directPlay
|
|
||||||
@Published var videoUrl: URL = URL(string: "https://example.com")!
|
|
||||||
}
|
|
||||||
|
|
||||||
protocol PlayerViewControllerDelegate: AnyObject {
|
protocol PlayerViewControllerDelegate: AnyObject {
|
||||||
func hideLoadingView(_ viewController: PlayerViewController)
|
func hideLoadingView(_ viewController: PlayerViewController)
|
||||||
func showLoadingView(_ viewController: PlayerViewController)
|
func showLoadingView(_ viewController: PlayerViewController)
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
//
|
||||||
|
/*
|
||||||
|
* SwiftFin is subject to the terms of the Mozilla Public
|
||||||
|
* License, v2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* Copyright 2021 Aiden Vigue & Jellyfin Contributors
|
||||||
|
*/
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import JellyfinAPI
|
||||||
|
|
||||||
|
struct Subtitle {
|
||||||
|
var name: String
|
||||||
|
var id: Int32
|
||||||
|
var url: URL?
|
||||||
|
var delivery: SubtitleDeliveryMethod
|
||||||
|
var codec: String
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AudioTrack {
|
||||||
|
var name: String
|
||||||
|
var id: Int32
|
||||||
|
}
|
||||||
|
|
||||||
|
class PlaybackItem: ObservableObject {
|
||||||
|
@Published var videoType: PlayMethod = .directPlay
|
||||||
|
@Published var videoUrl: URL = URL(string: "https://example.com")!
|
||||||
|
}
|
Loading…
Reference in New Issue