forked from sahin/mobileplayer-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Examples] Add pre-roll and pause overlay examples
- Loading branch information
Showing
13 changed files
with
359 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
MobilePlayerExamples/Assets.xcassets/PauseOverlayExampleCode.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
Binary file added
BIN
+26.5 KB
...es/Assets.xcassets/PauseOverlayExampleCode.imageset/PauseOverlayExampleCode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
MobilePlayerExamples/Assets.xcassets/PrerollExampleCode.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
Binary file added
BIN
+25.9 KB
...ayerExamples/Assets.xcassets/PrerollExampleCode.imageset/PrerollExampleCode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
MobilePlayerExamples/PauseOverlayExampleViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
Oops, something went wrong.