Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,25 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-stack-view">
<rect key="frame" x="100" y="54" width="214" height="61.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enable QOE Aggregate" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-label">
<rect key="frame" x="32" y="0.0" width="150" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-switch">
<rect key="frame" x="82.5" y="28.5" width="51" height="31"/>
<connections>
<action selector="qoeSwitchChangedWithSender:" destination="BYZ-38-t0r" eventType="valueChanged" id="qoe-switch-action"/>
</connections>
</switch>
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="50W-oq-dv4">
<rect key="frame" x="185.5" y="89" width="43" height="30"/>
<rect key="frame" x="185.5" y="135.5" width="43" height="30"/>
<state key="normal" title="Bunny"/>
<connections>
<action selector="clickPlayBunnyWithSender:" destination="BYZ-38-t0r" eventType="touchUpInside" id="mu4-uj-EfE"/>
Expand All @@ -27,10 +44,15 @@
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="50W-oq-dv4" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="45" id="IDN-EU-xLg"/>
<constraint firstItem="qoe-stack-view" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="10" id="qoe-stack-top"/>
<constraint firstItem="qoe-stack-view" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="qoe-stack-centerX"/>
<constraint firstItem="50W-oq-dv4" firstAttribute="top" secondItem="qoe-stack-view" secondAttribute="bottom" constant="20" id="IDN-EU-xLg"/>
<constraint firstItem="50W-oq-dv4" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="zv4-qX-dBN"/>
</constraints>
</view>
<connections>
<outlet property="qoeSwitch" destination="qoe-switch" id="qoe-switch-outlet"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class ViewController: UIViewController, AVPlayerViewControllerDelegate {
private var trackerId: Int = 0
private var inPiP: Bool = false

// QOE Toggle
@IBOutlet weak var qoeSwitch: UISwitch!

// IMA Ad Properties
private var adsLoader: IMAAdsLoader?
private var adsManager: IMAAdsManager?
Expand All @@ -28,7 +31,21 @@ class ViewController: UIViewController, AVPlayerViewControllerDelegate {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
// Initialize QOE switch to match current configuration
qoeSwitch.isOn = NRVAVideo.isQoeAggregateEnabled()
}

@IBAction func qoeSwitchChanged(_ sender: UISwitch) {
NRVAVideo.setQoeAggregateEnabled(sender.isOn)

let message = sender.isOn ? "QOE Aggregate Enabled" : "QOE Aggregate Disabled"
let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert)
present(alert, animated: true)

// Auto-dismiss after 1 second
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
alert.dismiss(animated: true)
}
}

func playVideo(videoURL: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,25 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-stack-view">
<rect key="frame" x="100" y="54" width="214" height="61.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enable QOE Aggregate" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-label">
<rect key="frame" x="32" y="0.0" width="150" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-switch">
<rect key="frame" x="82.5" y="28.5" width="51" height="31"/>
<connections>
<action selector="qoeSwitchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="qoe-switch-action"/>
</connections>
</switch>
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iII-oe-tup">
<rect key="frame" x="185.5" y="64" width="43" height="30"/>
<rect key="frame" x="185.5" y="135.5" width="43" height="30"/>
<state key="normal" title="Bunny"/>
<connections>
<action selector="clickBunnyVideo:" destination="BYZ-38-t0r" eventType="touchUpInside" id="hjQ-KU-Pkq"/>
Expand Down Expand Up @@ -48,8 +65,10 @@
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="qoe-stack-view" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="10" id="qoe-stack-top"/>
<constraint firstItem="qoe-stack-view" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="qoe-stack-centerX"/>
<constraint firstItem="suR-aY-bKa" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="5lC-R0-DCE"/>
<constraint firstItem="iII-oe-tup" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="20" id="8k7-Tu-H70"/>
<constraint firstItem="iII-oe-tup" firstAttribute="top" secondItem="qoe-stack-view" secondAttribute="bottom" constant="20" id="8k7-Tu-H70"/>
<constraint firstItem="iII-oe-tup" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="FRI-W1-zHc"/>
<constraint firstItem="gN7-1c-zoY" firstAttribute="top" secondItem="iII-oe-tup" secondAttribute="bottom" constant="8" symbolic="YES" id="f8g-kn-Rd5"/>
<constraint firstItem="suR-aY-bKa" firstAttribute="top" secondItem="gN7-1c-zoY" secondAttribute="bottom" constant="8" symbolic="YES" id="h7F-1K-QSv"/>
Expand All @@ -58,6 +77,9 @@
<constraint firstItem="HKy-DA-3hh" firstAttribute="top" secondItem="suR-aY-bKa" secondAttribute="bottom" constant="8" symbolic="YES" id="tnN-X7-75i"/>
</constraints>
</view>
<connections>
<outlet property="qoeSwitch" destination="qoe-switch" id="qoe-switch-outlet"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
#import "ViewController.h"
#import <NewRelicVideoCore/NRVAVideo.h>
#import <NewRelicVideoCore/NRVAVideoPlayerConfiguration.h>
#import <UIKit/UIKit.h>

@import AVKit;

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UISwitch *qoeSwitch;
@property (nonatomic) AVPlayerViewController *playerController;
@property (nonatomic) NSInteger trackerId;

Expand All @@ -38,9 +40,29 @@ - (IBAction)clickGearExample:(id)sender {

- (void)viewDidLoad {
[super viewDidLoad];

// Initialize QOE switch to match current configuration
self.qoeSwitch.on = [NRVAVideo isQoeAggregateEnabled];

NSLog(@"🎬 [ViewController] Simple Player - Ready for video tracking");
}

- (IBAction)qoeSwitchChanged:(UISwitch *)sender {
[NRVAVideo setQoeAggregateEnabled:sender.on];

NSString *message = sender.on ? @"QOE Aggregate Enabled" : @"QOE Aggregate Disabled";
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:YES completion:nil];

// Auto-dismiss after 1 second
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)),
dispatch_get_main_queue(), ^{
[alert dismissViewControllerAnimated:YES completion:nil];
});
}

- (void)dealloc {
// Clean up tracker when view controller is deallocated
[NRVAVideo releaseTracker:self.trackerId];
Expand Down
12 changes: 6 additions & 6 deletions Examples/iOS/SimplePlayerWithAds/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- GoogleAds-IMA-iOS-SDK (3.19.2)
- NewRelicVideoAgent (4.0.0)
- NRAVPlayerTracker (4.0.0):
- NewRelicVideoAgent (4.0.2)
- NRAVPlayerTracker (4.0.2):
- NewRelicVideoAgent
- NRIMATracker (4.0.0):
- NRIMATracker (4.0.2):
- GoogleAds-IMA-iOS-SDK
- GoogleAds-IMA-tvOS-SDK
- NewRelicVideoAgent
Expand All @@ -27,9 +27,9 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
GoogleAds-IMA-iOS-SDK: 0e817c05ab26f1b9285c80f4a75e1350a916d50b
NewRelicVideoAgent: ee0c43d7490ab9d259c04e531f9b7fec95704033
NRAVPlayerTracker: 08d98564362d7a83873de2ef4e443e2027b7138a
NRIMATracker: 96a64252d8a7f0569c2af1b129bbfbf44353e8ad
NewRelicVideoAgent: 72c71854da1b79a864ba867df1ac88619a3d05a6
NRAVPlayerTracker: 7dc7afcc0c7c9d60891f627f3035ade0e8f6f2d3
NRIMATracker: 70741ad94e5b3375f5999b47c8aa2fa102e6dabb

PODFILE CHECKSUM: 053b07d4805c2a687fc4558c91431e36b579f061

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,25 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-stack-view">
<rect key="frame" x="100" y="54" width="214" height="61.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enable QOE Aggregate" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-label">
<rect key="frame" x="32" y="0.0" width="150" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qoe-switch">
<rect key="frame" x="82.5" y="28.5" width="51" height="31"/>
<connections>
<action selector="qoeSwitchChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="qoe-switch-action"/>
</connections>
</switch>
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SYT-KN-Mbj">
<rect key="frame" x="185.5" y="89" width="43" height="30"/>
<rect key="frame" x="185.5" y="135.5" width="43" height="30"/>
<state key="normal" title="Bunny"/>
<connections>
<action selector="clickBunnyVideo:" destination="BYZ-38-t0r" eventType="touchUpInside" id="gBu-eA-egY"/>
Expand All @@ -41,14 +58,19 @@
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="qoe-stack-view" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="10" id="qoe-stack-top"/>
<constraint firstItem="qoe-stack-view" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="qoe-stack-centerX"/>
<constraint firstItem="mE9-jZ-GW1" firstAttribute="top" secondItem="SYT-KN-Mbj" secondAttribute="bottom" constant="8" symbolic="YES" id="Ac8-jI-LFT"/>
<constraint firstItem="SYT-KN-Mbj" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="45" id="Pey-Rt-KAw"/>
<constraint firstItem="SYT-KN-Mbj" firstAttribute="top" secondItem="qoe-stack-view" secondAttribute="bottom" constant="20" id="Pey-Rt-KAw"/>
<constraint firstItem="SYT-KN-Mbj" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="ewW-Mb-6C4"/>
<constraint firstItem="O1G-sW-eRA" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="ixp-1w-3Vs"/>
<constraint firstItem="mE9-jZ-GW1" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="sJY-1J-bdG"/>
<constraint firstItem="O1G-sW-eRA" firstAttribute="top" secondItem="mE9-jZ-GW1" secondAttribute="bottom" constant="8" symbolic="YES" id="t0d-wV-mJO"/>
</constraints>
</view>
<connections>
<outlet property="qoeSwitch" destination="qoe-switch" id="qoe-switch-outlet"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
#import <NewRelicVideoCore.h>

@import AVKit;
@import UIKit;

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UISwitch *qoeSwitch;
@property (nonatomic) AVPlayerViewController *playerController;
@property (nonatomic) NSInteger trackerId;
@property (nonatomic) NSString *multipleAdTagURL;
Expand All @@ -36,14 +38,33 @@ - (IBAction)clickAirshowLive:(id)sender {

- (void)viewDidLoad {
[super viewDidLoad];


// Initialize QOE switch to match current configuration
self.qoeSwitch.on = [NRVAVideo isQoeAggregateEnabled];

self.multipleAdTagURL = @"http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=xml_vmap1&unviewed_position_start=1&cust_params=sample_ar%3Dpremidpostpod%26deployment%3Dgmf-js&cmsid=496&vid=short_onecue&correlator=";

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification
object:nil];


}

- (IBAction)qoeSwitchChanged:(UISwitch *)sender {
[NRVAVideo setQoeAggregateEnabled:sender.on];

NSString *message = sender.on ? @"QOE Aggregate Enabled" : @"QOE Aggregate Disabled";
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:YES completion:nil];

// Auto-dismiss after 1 second
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)),
dispatch_get_main_queue(), ^{
[alert dismissViewControllerAnimated:YES completion:nil];
});
}

- (void)appDidBecomeActive:(NSNotification *)notif {
Expand Down
Loading