Skip to content

Commit

Permalink
[Examples] Add pre-roll and pause overlay examples
Browse files Browse the repository at this point in the history
  • Loading branch information
isair committed Dec 10, 2015
1 parent 08b0984 commit 0ba280c
Show file tree
Hide file tree
Showing 13 changed files with 359 additions and 9 deletions.
60 changes: 52 additions & 8 deletions MobilePlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

/* Begin PBXBuildFile section */
5F31B7B91BBAE39900EF50C4 /* MobilePlayerNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F31B7B81BBAE39900EF50C4 /* MobilePlayerNotification.swift */; };
5F3F03C31C18E73200EF50C4 /* PrerollExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3F03C21C18E73200EF50C4 /* PrerollExampleViewController.swift */; };
5F3F03C51C18E74000EF50C4 /* PauseOverlayExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3F03C41C18E74000EF50C4 /* PauseOverlayExampleViewController.swift */; };
5F3F03C71C18E75300EF50C4 /* PostrollExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3F03C61C18E75300EF50C4 /* PostrollExampleViewController.swift */; };
5F3F03CB1C18EA2A00EF50C4 /* PrerollOverlayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3F03CA1C18EA2A00EF50C4 /* PrerollOverlayViewController.swift */; };
5F3F03CD1C18EA4900EF50C4 /* PrerollOverlayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5F3F03CC1C18EA4900EF50C4 /* PrerollOverlayViewController.xib */; };
5F3F03CF1C18F3DA00EF50C4 /* PauseOverlayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3F03CE1C18F3DA00EF50C4 /* PauseOverlayViewController.swift */; };
5F3F03D11C18FED600EF50C4 /* PauseOverlayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5F3F03D01C18FED600EF50C4 /* PauseOverlayViewController.xib */; };
5F4CED431C054A5200EF50C4 /* WatermarkedPlayer.json in Resources */ = {isa = PBXBuildFile; fileRef = 5F4CED421C054A5200EF50C4 /* WatermarkedPlayer.json */; };
5F56CB721C0407F200EF50C4 /* MobilePlayerExampleStores.h in Headers */ = {isa = PBXBuildFile; fileRef = 5F56CB711C0407F200EF50C4 /* MobilePlayerExampleStores.h */; settings = {ATTRIBUTES = (Public, ); }; };
5F56CB7C1C04080500EF50C4 /* ProductStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F56CB7B1C04080500EF50C4 /* ProductStore.swift */; };
Expand Down Expand Up @@ -136,6 +143,13 @@
460022C3A2D4FC80A1D57D18 /* Pods-MobilePlayerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MobilePlayerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MobilePlayerTests/Pods-MobilePlayerTests.release.xcconfig"; sourceTree = "<group>"; };
505CCD80FF878F8F17EC4627 /* Pods_MobilePlayerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MobilePlayerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5F31B7B81BBAE39900EF50C4 /* MobilePlayerNotification.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobilePlayerNotification.swift; sourceTree = "<group>"; };
5F3F03C21C18E73200EF50C4 /* PrerollExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrerollExampleViewController.swift; sourceTree = "<group>"; };
5F3F03C41C18E74000EF50C4 /* PauseOverlayExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PauseOverlayExampleViewController.swift; sourceTree = "<group>"; };
5F3F03C61C18E75300EF50C4 /* PostrollExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostrollExampleViewController.swift; sourceTree = "<group>"; };
5F3F03CA1C18EA2A00EF50C4 /* PrerollOverlayViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrerollOverlayViewController.swift; sourceTree = "<group>"; };
5F3F03CC1C18EA4900EF50C4 /* PrerollOverlayViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PrerollOverlayViewController.xib; sourceTree = "<group>"; };
5F3F03CE1C18F3DA00EF50C4 /* PauseOverlayViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PauseOverlayViewController.swift; sourceTree = "<group>"; };
5F3F03D01C18FED600EF50C4 /* PauseOverlayViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PauseOverlayViewController.xib; sourceTree = "<group>"; };
5F4CED421C054A5200EF50C4 /* WatermarkedPlayer.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = WatermarkedPlayer.json; path = Resources/WatermarkedPlayer.json; sourceTree = "<group>"; };
5F56CB6F1C0407F200EF50C4 /* MobilePlayerExampleStores.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MobilePlayerExampleStores.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5F56CB711C0407F200EF50C4 /* MobilePlayerExampleStores.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MobilePlayerExampleStores.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -276,6 +290,35 @@
name = Resources;
sourceTree = "<group>";
};
5F3F03C81C18E9EE00EF50C4 /* Examples */ = {
isa = PBXGroup;
children = (
5F56CBB01C04178C00EF50C4 /* PlainExampleViewController.swift */,
5F56CBB41C041DA200EF50C4 /* ConfigExampleViewController.swift */,
5F56CBB61C041DAE00EF50C4 /* RemoteConfigExampleViewController.swift */,
5FF829661C168E4700EF50C4 /* ProgConfigExampleViewController.swift */,
5FF829641C168ACC00EF50C4 /* AdvancedConfigExampleViewController.swift */,
5F7974771C17B02200EF50C4 /* OverlayExampleViewController.swift */,
5F79747B1C17ED7800EF50C4 /* TimedOverlayExampleViewController.swift */,
5F3F03C21C18E73200EF50C4 /* PrerollExampleViewController.swift */,
5F3F03C41C18E74000EF50C4 /* PauseOverlayExampleViewController.swift */,
5F3F03C61C18E75300EF50C4 /* PostrollExampleViewController.swift */,
);
name = Examples;
sourceTree = "<group>";
};
5F3F03C91C18EA0300EF50C4 /* Overlays */ = {
isa = PBXGroup;
children = (
5F7974791C17B67F00EF50C4 /* BuyOverlayViewController.swift */,
5F3F03CA1C18EA2A00EF50C4 /* PrerollOverlayViewController.swift */,
5F3F03CC1C18EA4900EF50C4 /* PrerollOverlayViewController.xib */,
5F3F03CE1C18F3DA00EF50C4 /* PauseOverlayViewController.swift */,
5F3F03D01C18FED600EF50C4 /* PauseOverlayViewController.xib */,
);
name = Overlays;
sourceTree = "<group>";
};
5F56CB701C0407F200EF50C4 /* MobilePlayerExampleStores */ = {
isa = PBXGroup;
children = (
Expand All @@ -293,14 +336,8 @@
5F56CB831C040E8D00EF50C4 /* AppDelegate.swift */,
5F56CBA81C04102300EF50C4 /* ExamplesTableViewController.swift */,
5F56CBB21C04179700EF50C4 /* ExampleViewController.swift */,
5F56CBB01C04178C00EF50C4 /* PlainExampleViewController.swift */,
5F56CBB41C041DA200EF50C4 /* ConfigExampleViewController.swift */,
5F56CBB61C041DAE00EF50C4 /* RemoteConfigExampleViewController.swift */,
5FF829661C168E4700EF50C4 /* ProgConfigExampleViewController.swift */,
5FF829641C168ACC00EF50C4 /* AdvancedConfigExampleViewController.swift */,
5F7974771C17B02200EF50C4 /* OverlayExampleViewController.swift */,
5F7974791C17B67F00EF50C4 /* BuyOverlayViewController.swift */,
5F79747B1C17ED7800EF50C4 /* TimedOverlayExampleViewController.swift */,
5F3F03C81C18E9EE00EF50C4 /* Examples */,
5F3F03C91C18EA0300EF50C4 /* Overlays */,
5F56CB8C1C040E8D00EF50C4 /* Assets.xcassets */,
5F56CB8E1C040E8D00EF50C4 /* LaunchScreen.storyboard */,
5F56CB911C040E8D00EF50C4 /* Info.plist */,
Expand Down Expand Up @@ -677,7 +714,9 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5F3F03D11C18FED600EF50C4 /* PauseOverlayViewController.xib in Resources */,
5F4CED431C054A5200EF50C4 /* WatermarkedPlayer.json in Resources */,
5F3F03CD1C18EA4900EF50C4 /* PrerollOverlayViewController.xib in Resources */,
5F56CB901C040E8D00EF50C4 /* LaunchScreen.storyboard in Resources */,
5FF829691C16924400EF50C4 /* MovielalaPlayer.json in Resources */,
5F56CB8D1C040E8D00EF50C4 /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -742,17 +781,22 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5F3F03C51C18E74000EF50C4 /* PauseOverlayExampleViewController.swift in Sources */,
5F3F03C31C18E73200EF50C4 /* PrerollExampleViewController.swift in Sources */,
5F56CB841C040E8D00EF50C4 /* AppDelegate.swift in Sources */,
5F79747C1C17ED7800EF50C4 /* TimedOverlayExampleViewController.swift in Sources */,
5F3F03CF1C18F3DA00EF50C4 /* PauseOverlayViewController.swift in Sources */,
5FF829671C168E4700EF50C4 /* ProgConfigExampleViewController.swift in Sources */,
5F7974781C17B02200EF50C4 /* OverlayExampleViewController.swift in Sources */,
5F56CBB71C041DAE00EF50C4 /* RemoteConfigExampleViewController.swift in Sources */,
5F56CBB31C04179700EF50C4 /* ExampleViewController.swift in Sources */,
5F3F03C71C18E75300EF50C4 /* PostrollExampleViewController.swift in Sources */,
5F79747A1C17B67F00EF50C4 /* BuyOverlayViewController.swift in Sources */,
5F56CBB11C04178C00EF50C4 /* PlainExampleViewController.swift in Sources */,
5FF829651C168ACC00EF50C4 /* AdvancedConfigExampleViewController.swift in Sources */,
5F56CBB51C041DA200EF50C4 /* ConfigExampleViewController.swift in Sources */,
5F56CBA91C04102300EF50C4 /* ExamplesTableViewController.swift in Sources */,
5F3F03CB1C18EA2A00EF50C4 /* PrerollOverlayViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "PauseOverlayExampleCode.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "PrerollExampleCode.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion MobilePlayerExamples/ExamplesTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class ExamplesTableViewController: UITableViewController {
ProgConfigExampleViewController(),
AdvancedConfigExampleViewController(),
OverlayExampleViewController(),
TimedOverlayExampleViewController()
TimedOverlayExampleViewController(),
PrerollExampleViewController(),
PauseOverlayExampleViewController(),
PostrollExampleViewController()
]

init() {
Expand Down
32 changes: 32 additions & 0 deletions MobilePlayerExamples/PauseOverlayExampleViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// PauseOverlayExampleViewController.swift
// MobilePlayer
//
// Created by Baris Sencan on 09/12/2015.
// Copyright © 2015 MovieLaLa. All rights reserved.
//

import Foundation
import MobilePlayer

class PauseOverlayExampleViewController: ExampleViewController {

override init() {
super.init()
title = "Showing a Pause Overlay"
codeImageView.image = UIImage(named: "PauseOverlayExampleCode")
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func showButtonDidGetTapped() {
let playerVC = MobilePlayerViewController(
contentURL: videoURL,
pauseOverlayViewController: PauseOverlayViewController())
playerVC.title = videoTitle
playerVC.activityItems = [videoURL]
presentMoviePlayerViewControllerAnimated(playerVC)
}
}
27 changes: 27 additions & 0 deletions MobilePlayerExamples/PauseOverlayViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// PauseOverlayViewController.swift
// MobilePlayer
//
// Created by Baris Sencan on 09/12/2015.
// Copyright © 2015 MovieLaLa. All rights reserved.
//

import Foundation
import MobilePlayer

class PauseOverlayViewController: MobilePlayerOverlayViewController {
@IBOutlet weak var containerView: UIView!

init() {
super.init(nibName: "PauseOverlayViewController", bundle: nil)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()
containerView.layer.cornerRadius = 6
}
}
58 changes: 58 additions & 0 deletions MobilePlayerExamples/PauseOverlayViewController.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PauseOverlayViewController" customModule="MobilePlayerExamples" customModuleProvider="target">
<connections>
<outlet property="containerView" destination="WmF-yI-6ca" id="1mI-Xz-CBk"/>
<outlet property="view" destination="iN0-l3-epB" id="D5V-wo-JKL"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WmF-yI-6ca">
<rect key="frame" x="50" y="239" width="500" height="122"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="MovielalaLogo" translatesAutoresizingMaskIntoConstraints="NO" id="eTR-d2-6zm">
<rect key="frame" x="175" y="8" width="150" height="57"/>
<animations/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This is a pause overlay; shown only when playback is paused and dismissed automatically when it continues." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yxx-hc-1h6">
<rect key="frame" x="8" y="73" width="484" height="41"/>
<animations/>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="eTR-d2-6zm" firstAttribute="top" secondItem="WmF-yI-6ca" secondAttribute="top" constant="8" id="9IZ-w1-jty"/>
<constraint firstItem="Yxx-hc-1h6" firstAttribute="centerX" secondItem="WmF-yI-6ca" secondAttribute="centerX" id="AEo-Pq-3hb"/>
<constraint firstItem="Yxx-hc-1h6" firstAttribute="top" secondItem="eTR-d2-6zm" secondAttribute="bottom" constant="8" id="RRb-4T-p4l"/>
<constraint firstAttribute="bottom" secondItem="Yxx-hc-1h6" secondAttribute="bottom" constant="8" id="WPG-Md-uKL"/>
<constraint firstItem="Yxx-hc-1h6" firstAttribute="width" secondItem="WmF-yI-6ca" secondAttribute="width" constant="-16" id="a22-81-JFM"/>
<constraint firstItem="eTR-d2-6zm" firstAttribute="centerX" secondItem="WmF-yI-6ca" secondAttribute="centerX" id="qKP-WV-FLB"/>
</constraints>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="WmF-yI-6ca" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="h9x-1u-U9U"/>
<constraint firstItem="WmF-yI-6ca" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" constant="-100" id="kfU-dN-Who"/>
<constraint firstItem="WmF-yI-6ca" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="pQL-C7-sEl"/>
</constraints>
</view>
</objects>
<resources>
<image name="MovielalaLogo" width="150" height="57"/>
</resources>
</document>
26 changes: 26 additions & 0 deletions MobilePlayerExamples/PostrollExampleViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// PostrollExampleViewController.swift
// MobilePlayer
//
// Created by Baris Sencan on 09/12/2015.
// Copyright © 2015 MovieLaLa. All rights reserved.
//

import Foundation
import MobilePlayer

class PostrollExampleViewController: ExampleViewController {

override init() {
super.init()
title = "Showing a Post-roll"
codeImageView.image = UIImage(named: "PostrollExampleCode")
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func showButtonDidGetTapped() {
}
}
32 changes: 32 additions & 0 deletions MobilePlayerExamples/PrerollExampleViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// PrerollExampleViewController.swift
// MobilePlayer
//
// Created by Baris Sencan on 09/12/2015.
// Copyright © 2015 MovieLaLa. All rights reserved.
//

import Foundation
import MobilePlayer

class PrerollExampleViewController: ExampleViewController {

override init() {
super.init()
title = "Showing a Pre-roll"
codeImageView.image = UIImage(named: "PrerollExampleCode")
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func showButtonDidGetTapped() {
let playerVC = MobilePlayerViewController(
contentURL: videoURL,
prerollViewController: PrerollOverlayViewController())
playerVC.title = videoTitle
playerVC.activityItems = [videoURL]
presentMoviePlayerViewControllerAnimated(playerVC)
}
}
27 changes: 27 additions & 0 deletions MobilePlayerExamples/PrerollOverlayViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// PrerollOverlayViewController.swift
// MobilePlayer
//
// Created by Baris Sencan on 09/12/2015.
// Copyright © 2015 MovieLaLa. All rights reserved.
//

import Foundation
import MobilePlayer

class PrerollOverlayViewController: MobilePlayerOverlayViewController {

init() {
super.init(nibName: "PrerollOverlayViewController", bundle: nil)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

@IBAction func visitButtonDidGetTapped() {
guard let websiteURL = NSURL(string: "https://movielala.com") else { return }
UIApplication.sharedApplication().openURL(websiteURL)
dismiss() // or mobilePlayer.play()
}
}
Loading

0 comments on commit 0ba280c

Please sign in to comment.