Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 5 #7

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
40f2302
Adding Chapter 5 KitTime Player sample initial Swift 5 port.
Jan 31, 2020
5c94b80
Port Chapter class.
Feb 2, 2020
eb15926
Convert Window class.
Feb 2, 2020
775f72a
Cleanup.
Feb 2, 2020
a42acfe
Port LoadingView.
Feb 2, 2020
6417ccb
Remove old cruft.
Feb 2, 2020
88c6e68
Remove more cruft.
Feb 2, 2020
6254a71
Remove custom window class.
Feb 2, 2020
becc466
Revert "Remove more cruft."
Feb 2, 2020
af672e4
Port ExportWindowController to Swift.
Feb 2, 2020
0549187
Remove Timer+Additions.swift.
Feb 2, 2020
6cab199
Improve ExportWindowController.
Feb 2, 2020
c27a097
Implement logging,
Feb 2, 2020
b1508ef
Cleanup.
Feb 2, 2020
38547af
Start handling existing exported files.
Feb 2, 2020
96ee8ec
Improve export error handling.
Feb 3, 2020
953d896
Initial attempt to handle existing file properly when exporting.
Feb 3, 2020
c2ced29
Improve order.
Feb 3, 2020
a61f86b
Improve handling existing file when exporting.
Feb 3, 2020
03f9d0b
Cleanup.
Feb 3, 2020
4a5a99b
Refactor.
Feb 3, 2020
9c7b1b5
Fix reverse option being ignored in findChapter().
Feb 3, 2020
943a791
Cleanup.
Feb 3, 2020
6792cf9
Improve time handling.
Feb 3, 2020
aaaf9fb
Fix MARK.
Feb 3, 2020
c52bddf
Removing last Obj-C remnants.
Feb 3, 2020
27bd0f8
Improve Info.plist.
Feb 3, 2020
c51efbe
Apply changes recommended by Xcode.
Feb 3, 2020
075bffe
Cleanup.
Feb 4, 2020
6f45118
Refactor into showAlert().
Feb 4, 2020
1216467
Cleanup.
Feb 4, 2020
ebc5387
Filter correct keyPath in observeValue().
Feb 4, 2020
5428dce
Cleanup.
Feb 4, 2020
8c6af0d
Use Swift 4+ observer syntax.
Feb 4, 2020
0db2b56
Add TODO.
Feb 4, 2020
00a40fc
Fix issue with the AVPlayerView UI’s slider does not being movable in…
Feb 10, 2020
8540c4e
Add comment.
Feb 10, 2020
8bc2524
Rename showAlert(for:) to handleError().
Feb 10, 2020
f15e97a
Experiment with UI signaling of loading results.
Feb 10, 2020
8552681
Cleanup.
Feb 10, 2020
56dc013
Fix typo.
Feb 10, 2020
5daa8ff
Cleanup.
Feb 10, 2020
a2ebff3
Remove dangling outlets.
Feb 10, 2020
16399be
Add support for dynamic `aspectRatioConstraint`.
Feb 10, 2020
c9b910e
Cleanup.
Feb 10, 2020
1b8ef31
Improve support for dynamic `aspectRatioConstraint`.
Feb 11, 2020
4de6fbf
Fix AppDelegate.
Mar 14, 2020
958348c
Xcode touched shared xcscheme.
Mar 14, 2020
cb7b468
Fix retain cycles and pause playback on deinitilization.
May 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
422 changes: 422 additions & 0 deletions Chapter 5/KitTime Player/KitTime Player.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C43BDA7018010C6600AD0F16"
BuildableName = "KitTime Player.app"
BlueprintName = "KitTime Player"
ReferencedContainer = "container:KitTime Player.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C43BDA7018010C6600AD0F16"
BuildableName = "KitTime Player.app"
BlueprintName = "KitTime Player"
ReferencedContainer = "container:KitTime Player.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C43BDA7018010C6600AD0F16"
BuildableName = "KitTime Player.app"
BlueprintName = "KitTime Player"
ReferencedContainer = "container:KitTime Player.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
39 changes: 39 additions & 0 deletions Chapter 5/KitTime Player/KitTime Player/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// MIT License
//
// Copyright (c) 2020 Jan Weiß http://geheimwerk.de/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}

func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}

}

128 changes: 128 additions & 0 deletions Chapter 5/KitTime Player/KitTime Player/Base.lproj/Document.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16085" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.AVKitIBPlugin" version="16085"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16085"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="Document" customModule="KitTime_Player" customModuleProvider="target">
<connections>
<outlet property="aspectRatioConstraint" destination="vBW-W0-Hxw" id="Fs6-SE-fLr"/>
<outlet property="playerView" destination="yfh-YO-8JT" id="UE4-lj-ftW"/>
<outlet property="window" destination="5" id="18"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES"/>
<rect key="contentRect" x="100" y="457" width="640" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<value key="minSize" type="size" width="640" height="360"/>
<view key="contentView" id="6">
<rect key="frame" x="0.0" y="0.0" width="640" height="360"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<avPlayerView controlsStyle="floating" translatesAutoresizingMaskIntoConstraints="NO" id="yfh-YO-8JT">
<rect key="frame" x="0.0" y="0.0" width="640" height="360"/>
<constraints>
<constraint firstAttribute="width" secondItem="yfh-YO-8JT" secondAttribute="height" multiplier="16:9" id="vBW-W0-Hxw"/>
</constraints>
</avPlayerView>
<customView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PWK-72-tUU" userLabel="Custom View">
<rect key="frame" x="66" y="-11" width="508" height="382"/>
<subviews>
<progressIndicator wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="i8N-Qd-ZF8" userLabel="Async Arrows">
<rect key="frame" x="238" y="175" width="32" height="32"/>
<contentFilters>
<ciFilter name="CIColorInvert">
<configuration>
<null key="inputImage"/>
</configuration>
</ciFilter>
</contentFilters>
<connections>
<binding destination="-2" name="animate" keyPath="loadingSignal" id="Nz7-MW-R7u"/>
<binding destination="-2" name="hidden" keyPath="loadingSignal" id="i9S-SG-33d">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</progressIndicator>
<textField hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="y0C-CT-MAK">
<rect key="frame" x="204" y="176" width="100" height="29"/>
<constraints>
<constraint firstAttribute="height" constant="29" id="QcW-io-f95"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="No Video" id="SuN-uV-fad">
<font key="font" metaFont="system" size="24"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="hidden2" keyPath="enableNoVideoSignaling" previousBinding="Kaf-Iq-rPw" id="f8U-At-kTA">
<dictionary key="options">
<integer key="NSMultipleValuesPlaceholder" value="-1"/>
<integer key="NSNoSelectionPlaceholder" value="-1"/>
<integer key="NSNotApplicablePlaceholder" value="-1"/>
<integer key="NSNullPlaceholder" value="-1"/>
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
<binding destination="-2" name="hidden" keyPath="noVideoTracks" id="Kaf-Iq-rPw">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</textField>
<textField hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VyC-Vp-6BB">
<rect key="frame" x="161" y="176" width="186" height="29"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Unplayable Asset" id="yGd-K4-aQD">
<font key="font" metaFont="system" size="24"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="hidden" keyPath="unplayableFile" id="Nke-42-0rv">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="VyC-Vp-6BB" firstAttribute="baseline" secondItem="y0C-CT-MAK" secondAttribute="baseline" id="4vM-OL-cM8"/>
<constraint firstItem="y0C-CT-MAK" firstAttribute="centerX" secondItem="PWK-72-tUU" secondAttribute="centerX" id="CTu-eQ-i6J"/>
<constraint firstItem="VyC-Vp-6BB" firstAttribute="centerX" secondItem="y0C-CT-MAK" secondAttribute="centerX" id="N0n-JD-2uS"/>
<constraint firstItem="VyC-Vp-6BB" firstAttribute="firstBaseline" secondItem="y0C-CT-MAK" secondAttribute="firstBaseline" id="RNO-wu-JPq"/>
<constraint firstItem="y0C-CT-MAK" firstAttribute="centerY" secondItem="i8N-Qd-ZF8" secondAttribute="centerY" id="X3q-3E-Eju"/>
<constraint firstItem="VyC-Vp-6BB" firstAttribute="centerX" secondItem="i8N-Qd-ZF8" secondAttribute="centerX" id="hqk-7W-49L"/>
<constraint firstItem="VyC-Vp-6BB" firstAttribute="centerY" secondItem="PWK-72-tUU" secondAttribute="centerY" id="mKj-7r-Ic7"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="yfh-YO-8JT" firstAttribute="leading" secondItem="6" secondAttribute="leading" id="6A3-zK-5Kj"/>
<constraint firstAttribute="bottom" secondItem="yfh-YO-8JT" secondAttribute="bottom" id="JWa-8c-4Vt"/>
<constraint firstItem="PWK-72-tUU" firstAttribute="top" secondItem="6" secondAttribute="top" constant="-11" id="NrG-1i-2ec"/>
<constraint firstItem="PWK-72-tUU" firstAttribute="centerX" secondItem="yfh-YO-8JT" secondAttribute="centerX" id="X6T-OL-eF3"/>
<constraint firstItem="PWK-72-tUU" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="66" id="Ys0-CY-GMj"/>
<constraint firstItem="yfh-YO-8JT" firstAttribute="top" secondItem="6" secondAttribute="top" id="bXt-w8-CVS"/>
<constraint firstItem="PWK-72-tUU" firstAttribute="centerY" secondItem="yfh-YO-8JT" secondAttribute="centerY" id="imv-ti-QFF"/>
<constraint firstAttribute="trailing" secondItem="yfh-YO-8JT" secondAttribute="trailing" id="uba-Ym-c18"/>
</constraints>
</view>
<connections>
<outlet property="delegate" destination="-2" id="17"/>
</connections>
<point key="canvasLocation" x="140" y="147"/>
</window>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<userDefaultsController representsSharedInstance="YES" id="zyj-nA-50b"/>
</objects>
</document>
Loading