Skip to content

Commit

Permalink
navigation adapter added
Browse files Browse the repository at this point in the history
  • Loading branch information
esaygiver committed Mar 19, 2023
1 parent a18b806 commit 604d4b3
Show file tree
Hide file tree
Showing 19 changed files with 269 additions and 173 deletions.
4 changes: 4 additions & 0 deletions Example/EVPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
054C66B129C48865007810C6 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 054C66B029C48865007810C6 /* DetailViewController.swift */; };
4023CDD121E26305A4A2D428 /* Pods_EVPlayer_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E69C5B750995D242EB97C5D /* Pods_EVPlayer_Tests.framework */; };
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
Expand All @@ -28,6 +29,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
054C66B029C48865007810C6 /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
0E69C5B750995D242EB97C5D /* Pods_EVPlayer_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EVPlayer_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1072533C1591EE4D8F6CDBF1 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
1C435D38827410900FDC7ABA /* Pods-EVPlayer_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EVPlayer_Tests.release.xcconfig"; path = "Target Support Files/Pods-EVPlayer_Tests/Pods-EVPlayer_Tests.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -104,6 +106,7 @@
children = (
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
607FACD71AFB9204008FA782 /* ViewController.swift */,
054C66B029C48865007810C6 /* DetailViewController.swift */,
607FACD91AFB9204008FA782 /* Main.storyboard */,
607FACDC1AFB9204008FA782 /* Images.xcassets */,
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
Expand Down Expand Up @@ -332,6 +335,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
054C66B129C48865007810C6 /* DetailViewController.swift in Sources */,
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
);
Expand Down
66 changes: 61 additions & 5 deletions Example/EVPlayer/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="tvu-28-M5N">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -20,11 +18,69 @@
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vYX-Cl-oUf">
<rect key="frame" x="163" y="437" width="49" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="35" id="ByF-BQ-B2N"/>
</constraints>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="GO"/>
<connections>
<action selector="goTapped" destination="vXZ-lx-hvc" eventType="touchUpInside" id="pSm-jc-2cN"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="vYX-Cl-oUf" secondAttribute="bottom" constant="195" id="3ax-uo-W5t"/>
<constraint firstItem="vYX-Cl-oUf" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="wV6-dF-GXQ"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="ylM-iu-sOF"/>
<connections>
<outlet property="goButton" destination="vYX-Cl-oUf" id="Jiv-48-mtr"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="948" y="0.44977511244377816"/>
</scene>
<!--Detail View Controller-->
<scene sceneID="dvv-EQ-hdm">
<objects>
<viewController storyboardIdentifier="DetailViewController" id="vPJ-jB-njX" customClass="DetailViewController" customModule="EVPlayer_Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="PXd-c1-40m"/>
<viewControllerLayoutGuide type="bottom" id="nhU-0d-Igk"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="lDx-Or-pfw">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="0d2-LX-9oU" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1751" y="0.0"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="ycJ-Iq-Si2">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="tvu-28-M5N" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="HMA-pX-yAZ">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="vXZ-lx-hvc" kind="relationship" relationship="rootViewController" id="ZJA-3D-HKb"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="qbi-4k-QKL" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="127" y="0.0"/>
</scene>
</scenes>
</document>
19 changes: 19 additions & 0 deletions Example/EVPlayer/DetailViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// DetailViewController.swift
// EVPlayer_Example
//
// Created by Emirhan Saygiver on 17.03.2023.
// Copyright © 2023 CocoaPods. All rights reserved.
//

import UIKit

class DetailViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

}
26 changes: 19 additions & 7 deletions Example/EVPlayer/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
//

import UIKit
import AVKit
import EVPlayer

class ViewController: UIViewController {

@IBOutlet private weak var goButton: UIButton!

var evPlayer: EVPlayer!

let media = EVMedia(mediaURL: URL(string: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4"),
Expand All @@ -23,6 +24,11 @@ class ViewController: UIViewController {
configureEVPlayer()
}

// override func viewDidAppear(_ animated: Bool) {
// super.viewDidAppear(animated)
// evPlayer.changeStateForNavigationChanges(to: .play)
// }

private func configureEVPlayer() {
evPlayer = EVPlayer(frame: CGRect(x: 0, y: 0, width: 350, height: 200))

Expand All @@ -34,20 +40,26 @@ class ViewController: UIViewController {
initialState: .quickPlay)
evPlayer.load(with: config)
}

@IBAction private func goTapped() {
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "DetailViewController") as! DetailViewController
evPlayer.changeStateForNavigationChanges(to: .pause)
navigationController?.pushViewController(vc, animated: true)
}
}

extension ViewController: EVPlayerDelegate {

func stateDidChanged(player: AVPlayer?, to state: EVVideoState) {
func evPlayer(stateDidChangedTo state: EVVideoState) {
print("stateDidChanged", state)
}

func playTimeDidChanged(player: AVPlayer?, currentTime: Double, totalTime: Double, loadedRange: String) {
// print("DOWNLOADED -> %", loadedRange)
func evPlayer(timeChangedTo currentTime: Double, totalTime: Double, loadedRange: Double) {
print("loadedRange ->", loadedRange)
}

func fullScreenTransactionUpdate(to state: EVFullScreenState) {
print("Current FullScreen State:", state)
func evPlayer(fullScreenTransactionUpdateTo state: EVFullScreenState) {
print("stateDidChanged", state)
}
}

20 changes: 12 additions & 8 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 604d4b3

Please sign in to comment.