Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
merge swift 2 branch, update, and bumpt to v 0.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
spinosa committed Aug 31, 2016
2 parents 1444117 + dbcfd0c commit 95a3ef1
Show file tree
Hide file tree
Showing 14 changed files with 295 additions and 274 deletions.
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3', :commit => '3cc5b4e8453bec9fd6b973d60e6b0605a38e4cf4'
pod 'AlamofireImage', :git => 'https://github.com/Alamofire/AlamofireImage.git', :branch => 'swift3'

target 'WistiaKit_Example' do
Expand Down
12 changes: 7 additions & 5 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ PODS:
- Alamofire (4.0.0-beta.1)
- AlamofireImage (3.0.0-beta.1):
- Alamofire (= 4.0.0-beta.1)
- WistiaKit (0.10.1):
- WistiaKit (0.10.2):
- Alamofire (~> 4.0.0-beta.1)
- AlamofireImage (~> 3.0.-beta.1)
- AlamofireImage (~> 3.0.0-beta.1)

DEPENDENCIES:
- Alamofire (from `https://github.com/Alamofire/Alamofire.git`, branch `swift3`)
- Alamofire (from `https://github.com/Alamofire/Alamofire.git`, commit `3cc5b4e8453bec9fd6b973d60e6b0605a38e4cf4`, branch `swift3`)
- AlamofireImage (from `https://github.com/Alamofire/AlamofireImage.git`, branch `swift3`)
- WistiaKit (from `../`)

EXTERNAL SOURCES:
Alamofire:
:branch: swift3
:commit: 3cc5b4e8453bec9fd6b973d60e6b0605a38e4cf4
:git: https://github.com/Alamofire/Alamofire.git
AlamofireImage:
:branch: swift3
Expand All @@ -23,6 +24,7 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
Alamofire:
:branch: swift3
:commit: 3cc5b4e8453bec9fd6b973d60e6b0605a38e4cf4
:git: https://github.com/Alamofire/Alamofire.git
AlamofireImage:
Expand All @@ -32,8 +34,8 @@ CHECKOUT OPTIONS:
SPEC CHECKSUMS:
Alamofire: 698bf56c9e48d3248168e4a3a90588ac2e23836a
AlamofireImage: 1204674be7d67ea8efb61f38b2683a5ca0066452
WistiaKit: ca31f4ce4042d47296aea62f707ce91dd59f594b
WistiaKit: 37f1a40b949a59820aebb1d68e1102327e127698

PODFILE CHECKSUM: 22c9537cb0291f52e43612af3fe062821776ee6a
PODFILE CHECKSUM: 8dc6903c3c2213c033fb1924d10deb9e1eab9665

COCOAPODS: 1.0.1
6 changes: 3 additions & 3 deletions Example/Pods/Local Podspecs/WistiaKit.podspec.json

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

12 changes: 7 additions & 5 deletions Example/Pods/Manifest.lock

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

335 changes: 157 additions & 178 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Example/Pods/Target Support Files/WistiaKit/Info.plist

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

35 changes: 26 additions & 9 deletions Example/WistiaKit/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11198.2" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -13,42 +15,57 @@
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="CKq-en-nI8">
<rect key="frame" x="212" y="266" width="176" height="68"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="8tjg8ftj2p" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="6QF-di-8YI">
<rect key="frame" x="0.0" y="0.0" width="176" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="176" id="D2O-pq-iib"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="agd-xL-MAz">
<rect key="frame" x="71.5" y="38" width="33" height="30"/>
<state key="normal" title="Play!"/>
<connections>
<action selector="playTapped:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="oun-Pv-MHU"/>
<action selector="playTappedWithSender:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="is3-ic-90C"/>
</connections>
</button>
</subviews>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MmP-4t-i0z" customClass="WistiaFlatPlayerView" customModule="WistiaKit">
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="gGS-0q-4Mv">
<segments>
<segment title="WistiaPlayerViewController"/>
<segment title="WistiaPlayer"/>
</segments>
</segmentedControl>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.8666666666666667" green="0.8666666666666667" blue="0.8666666666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="CKq-en-nI8" firstAttribute="centerY" secondItem="kh9-bI-dsS" secondAttribute="centerY" id="Djs-Y2-gMP"/>
<constraint firstItem="CKq-en-nI8" firstAttribute="centerY" secondItem="kh9-bI-dsS" secondAttribute="centerY" constant="-150" id="Djs-Y2-gMP"/>
<constraint firstItem="CKq-en-nI8" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="PFn-pK-yXv"/>
<constraint firstItem="MmP-4t-i0z" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="8" id="Srx-wD-Nq2"/>
<constraint firstItem="MmP-4t-i0z" firstAttribute="top" secondItem="gGS-0q-4Mv" secondAttribute="bottom" constant="24" id="U8p-YH-Aid"/>
<constraint firstAttribute="trailingMargin" secondItem="MmP-4t-i0z" secondAttribute="trailing" constant="8" id="UvZ-rD-CLy"/>
<constraint firstItem="gGS-0q-4Mv" firstAttribute="top" secondItem="CKq-en-nI8" secondAttribute="bottom" constant="24" id="ftg-7C-VWz"/>
<constraint firstItem="gGS-0q-4Mv" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="iVI-sF-5bP"/>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="MmP-4t-i0z" secondAttribute="bottom" constant="8" id="kQ6-Ke-iuc"/>
</constraints>
</view>
<connections>
<outlet property="hashedIDTextField" destination="6QF-di-8YI" id="QmE-kV-oc2"/>
<outlet property="playerChooser" destination="gGS-0q-4Mv" id="J9z-Xe-hqn"/>
<outlet property="playerView" destination="MmP-4t-i0z" id="nt5-Wv-b54"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="365" y="249"/>
</scene>
</scenes>
</document>
44 changes: 40 additions & 4 deletions Example/WistiaKit/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,51 @@ import WistiaKit

class ViewController: UIViewController {

let wistiaPlayerVC = WistiaPlayerViewController(referrer: "WistiaKitDemo", requireHLS: false)
//MARK: - Common code

// The playerChooser can switch between playback using a presented WistiaPlayerViewController
// or, at a lower level, using a WistiaPlayer displayed through a sublayer in a child view.
@IBOutlet weak var playerChooser: UISegmentedControl!

@IBOutlet weak var hashedIDTextField: UITextField!

@IBAction func playTapped(_ sender: AnyObject) {
// Based on the playerChooser's state, first pause/dismiss the other player, then configure and
// play using the selected one.
@IBAction func playTapped(sender: AnyObject) {
if let hashedID = hashedIDTextField.text {
let _ = wistiaPlayerVC.replaceCurrentVideoWithVideo(forHashedID: hashedID)
self.present(wistiaPlayerVC, animated: true, completion: nil)
switch playerChooser.selectedSegmentIndex {
case 0:
wistiaPlayer.pause()

//Play using WistiaPlayerViewController
let _ = wistiaPlayerVC.replaceCurrentVideoWithVideo(forHashedID: hashedID)
self.present(wistiaPlayerVC, animated: true, completion: nil)

case 1:
self.dismiss(animated: true, completion: nil)

//Play using WistiaPlayer
let _ = wistiaPlayer.replaceCurrentVideoWithVideo(forHashedID: hashedID)
wistiaPlayer.play()

default:
break
}
}
}

//MARK: - WistiaPlayerViewController Specific

let wistiaPlayerVC = WistiaPlayerViewController(referrer: "WistiaKitDemo", requireHLS: false)

//MARK: - WistiaPlayer Specific

let wistiaPlayer = WistiaPlayer(referrer: "WistiaKitDemo", requireHLS: false)
@IBOutlet weak var playerView: WistiaFlatPlayerView!

override func viewDidLoad() {
playerView.wistiaPlayer = wistiaPlayer
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ extension WistiaPlayerViewController: WistiaPlayerDelegate {
player360View.isHidden = false
player360View.wPlayer = wPlayer
playerFlatView.isHidden = true
playerFlatView.playerLayer = nil
playerFlatView.wistiaPlayer = nil
} else {
playing360 = false
player360View.isHidden = true
player360View.wPlayer = nil
playerFlatView.isHidden = false
playerFlatView.playerLayer = wPlayer.newPlayerLayer()
playerFlatView.wistiaPlayer = wPlayer
}

currentMediaEmbedOptions = media.embedOptions
Expand Down
58 changes: 0 additions & 58 deletions Pod/Classes/internal/view/_WistiaFlatPlayerView.swift

This file was deleted.

31 changes: 31 additions & 0 deletions Pod/Classes/public/WistiaFlatPlayerView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// WistiaFlatPlayerView.swift
// WistiaKit
//
// Created by Daniel Spinosa on 11/15/15.
// Copyright © 2016 Wistia, Inc. All rights reserved.
//
// A View backed by an AVPlayerLayer.
//
// Set the wistiaPlayer and this view will pass it's AVPlayer through to the backing AVPlayerLayer.
//

import UIKit
import AVKit
import AVFoundation

public class WistiaFlatPlayerView: UIView {

override public class var layerClass: AnyClass {
get {
return AVPlayerLayer.self
}
}

public var wistiaPlayer:WistiaPlayer? {
didSet {
(self.layer as! AVPlayerLayer).player = wistiaPlayer?.avPlayer
}
}

}
13 changes: 9 additions & 4 deletions Pod/Classes/public/WistiaPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import AVFoundation

/**
The delegate of a `WistiaPlayer` must adopt the `WistiaPlayerDelegate `protocol. It will receive
state related information through the delegaet methods.
state related information through the delegate methods.

Information provided includes high-level state about the `WistiaPlayer` as well as state of the
underlying `AVPlayer`, normally obtained through Key-Value Observation (KVO).
Expand Down Expand Up @@ -442,11 +442,16 @@ public final class WistiaPlayer: NSObject {

/**
Create a new `AVPlayerLayer` configured for this instance of `WistiaPlayer`. This will remove
the player form any previously feteched `AVPlayerLayer`s.
the player form any previously fetched `AVPlayerLayer`s

See `AVPlayerLayer(player:)` for further information.
- Note: Unless you need a standalone layer, we recommend using a `WistiaFlatPlayerView` and setting
it's `wistiaPlayer` property to this instance. It is a regular `UIView` and often more familiar
than using layers without sacrificing much flexibility.

- Important: `AVPlayerLayer`s are created with size `CGSizeZero`. You will want to change that
if you wish to see the video. See `AVPlayerLayer(player:)` for further information.

- Returns: A new `AVPlayerLayer` to which we can direct our visual output.
- Returns: A new `AVPlayerLayer` to which we direct our visual output.
*/
public func newPlayerLayer() -> AVPlayerLayer? {
return AVPlayerLayer(player: avPlayer)
Expand Down
Loading

0 comments on commit 95a3ef1

Please sign in to comment.