This error means "failed to parse segment as either an MPEG-2 TS or an ES"
Post
Replies
Boosts
Views
Activity
@HighlyExperienced
You need redesign your code to make it main-thread-safety or you can use this snippet for working with UIKit:
void vkm_sync_main(dispatch_block_t block) {
if (block == nil) return;
if ([NSThread isMainThread]) {
block();
} else {
dispatch_sync(dispatch_get_main_queue(), block);
}
}
I changed Bundle version string (short) in the Info.plist file to proper from empty and archive was successfully uploaded!
I had the same issue when my tv has no connection to the Internet.
I found solution after long time of experiments: call play and pause in completion handler when seekToTime set time from another segment of current item track.
Hi! I found on iOS 13/14 the same issue with AVPlayer and composition like:
<AVMutableComposition: 0x2819a4000 tracks = (
"<AVMutableCompositionTrack: 0x28195a540 trackID = 1, mediaType = vide, editCount = 2>",
"<AVMutableCompositionTrack: 0x281960c40 trackID = 2, mediaType = soun, editCount = 2>"
)>
Also I noticed that it depends on video items duration - if videos is long (for example 7 seconds) - there is no bug, but with short videos - 2 seconds - it always appears with slow dragging the thumb of progress bar.
Thanks
Try to use context menu
https://developer.apple.com/videos/play/wwdc2020/10042/
You can use disabled modifier:
		VideoPlayer(player: player)
				.disabled(true)
`
You can modify internal UISplitViewController instance created by SwiftUI by yourself. But it is not good choice, because app not looks like as true macOS app and modified behaviour can be reseted by system at any time. I think that creating a new macOS target as wrapper for your common SwiftUI code is better solution.
You can freely use this snippet:
//
//	SceneDelegate.swift
//
//	Created by Egor Merkushev on 11.07.2020.
//	Copyright © 2020 Egor Merkushev. All rights reserved.
//
import UIKit
import SwiftUI
import CoreData
extension UIView {
		func findViews<T: UIView>(subclassOf: T.Type) -> [T] {
				return recursiveSubviews.compactMap { $0 as? T }
		}
		var recursiveSubviews: [UIView] {
				return subviews + subviews.flatMap { $0.recursiveSubviews }
		}
}
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
		var window: UIWindow?
		public static func vc<T: UIViewController>(vcKind: T.Type? = nil, window: UIWindow?) -> T? {
				 if let vc = window?.rootViewController as? T {
						 return vc
				 } else if let vc = window?.rootViewController?.presentedViewController as? T {
						 return vc
				 } else if let vc = window?.rootViewController?.children {
						 return vc.lazy.compactMap { $0 as? T }.first
				 }
				 return nil
		 }
		func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
				// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
				// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
				// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
				
				// Get the managed object context from the shared persistent container.
				let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
				// Create the SwiftUI view and set the context as the value for the managedObjectContext environment keyPath.
				// Add `@Environment(\.managedObjectContext)` in the views that will need the context.
				let contentView = ContentView().environment(\.managedObjectContext, context)
				
				// Use a UIHostingController as window root view controller.
				if let windowScene = scene as? UIWindowScene {
// hide title bar for macOS
		#if targetEnvironment(macCatalyst)
		 if let titlebar = windowScene.titlebar {
				 titlebar.titleVisibility = .hidden
		 		 titlebar.toolbar = nil
		 }
#endif
						let window = UIWindow(windowScene: windowScene)
						window.rootViewController = UIHostingController(rootView: contentView)
						self.window = window
						window.makeKeyAndVisible()
						
						let dispatchTime: DispatchTime = DispatchTime.now() + Double(Int64(0.1 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
						DispatchQueue.main.asyncAfter(deadline: dispatchTime, execute: {
								let vc = type(of: self).vc(vcKind: UISplitViewController.self, window: window)
								if let split = vc {
										split.primaryBackgroundStyle = .sidebar // this line changes style and adds visual effect with blur
										
										if let sidebarController = split.viewControllers.first {
												sidebarController.view.recursiveSubviews.forEach { (view) in
														if view.backgroundColor != nil {
																view.backgroundColor = .clear // aggressively makes all opaque views transparent, you can change it to fix only hosting view of SwiftUI in this sidebar controller
														}
												}
										}
								}
						})
				}
		}
...
Result you can see here
https://sun9-4 .userapi.com /CVTwqArD-9K-4JeFZOdaLjOFqH2Tkcq0puikPw/Cvt0PEItH8Y.jpg