forked from sahin/mobileplayer-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimedOverlayExampleViewController.swift
45 lines (40 loc) · 1.35 KB
/
TimedOverlayExampleViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// TimedOverlayExampleViewController.swift
// MobilePlayer
//
// Created by Baris Sencan on 08/12/2015.
// Copyright © 2015 MovieLaLa. All rights reserved.
//
import Foundation
import MobilePlayer
import MobilePlayerExampleStores
class TimedOverlayExampleViewController: ExampleViewController {
override init() {
super.init()
title = "Showing Timed Overlays"
codeImageView.image = UIImage(named: "TimedOverlayExampleCode")
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func showButtonDidGetTapped() {
let playerVC = MobilePlayerViewController(contentURL: videoURL)
playerVC.title = videoTitle
playerVC.activityItems = [videoURL]
presentMoviePlayerViewControllerAnimated(playerVC)
ProductStore.getProductPlacementsForVideo(
videoID,
success: { productPlacements in
guard let productPlacements = productPlacements else { return }
for placement in productPlacements {
ProductStore.getProduct(placement.productID, success: { product in
guard let product = product else { return }
playerVC.showOverlayViewController(
BuyOverlayViewController(product: product),
startingAtTime: placement.startTime,
forDuration: placement.duration)
})
}
})
}
}