Skip to content

Commit

Permalink
Merge branch 'release/2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Aug 13, 2019
2 parents 5429a38 + 86b769f commit e358834
Show file tree
Hide file tree
Showing 101 changed files with 550 additions and 399 deletions.
4 changes: 2 additions & 2 deletions Demo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Media Player</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down Expand Up @@ -35,8 +37,6 @@
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
6 changes: 6 additions & 0 deletions Demo/Resources/Images.xcassets/Tab Bar Icons/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "audios.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "multiplayer.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "segments.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "videos.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Binary file removed Demo/Resources/audios@2x.png
Binary file not shown.
Binary file removed Demo/Resources/screen@2x.png
Binary file not shown.
Binary file removed Demo/Resources/segments@2x.png
Binary file not shown.
Binary file removed Demo/Resources/videos@2x.png
Binary file not shown.
27 changes: 8 additions & 19 deletions Demo/Sources/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,25 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

UITabBarController *tabBarController = [[UITabBarController alloc] init];

MediasViewController *videosViewController = [[MediasViewController alloc] initWithConfigurationFileName:@"VideoDemoConfiguration" mediaPlayerType:MediaPlayerTypeStandard];
videosViewController.title = DemoNonLocalizedString(@"Videos");
videosViewController.tabBarItem.image = [UIImage imageNamed:@"videos"];
MediasViewController *videosViewController = [[MediasViewController alloc] initWithTitle:DemoNonLocalizedString(@"Videos") configurationFileName:@"VideoDemoConfiguration" mediaPlayerType:MediaPlayerTypeStandard];
UINavigationController *videosNavigationController = [[UINavigationController alloc] initWithRootViewController:videosViewController];
videosNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:DemoNonLocalizedString(@"Videos") image:[UIImage imageNamed:@"videos"] tag:0];

MediasViewController *segmentsViewController = [[MediasViewController alloc] initWithConfigurationFileName:@"SegmentDemoConfiguration" mediaPlayerType:MediaPlayerTypeSegments];
segmentsViewController.title = DemoNonLocalizedString(@"Segments");
segmentsViewController.tabBarItem.image = [UIImage imageNamed:@"screen"];
MediasViewController *segmentsViewController = [[MediasViewController alloc] initWithTitle:DemoNonLocalizedString(@"Segments") configurationFileName:@"SegmentDemoConfiguration" mediaPlayerType:MediaPlayerTypeSegments];
UINavigationController *segmentsNavigationController = [[UINavigationController alloc] initWithRootViewController:segmentsViewController];
segmentsNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:DemoNonLocalizedString(@"Segments") image:[UIImage imageNamed:@"segments"] tag:1];

MediasViewController *multiPlayerViewController = [[MediasViewController alloc] initWithConfigurationFileName:@"MultiPlayerDemoConfiguration" mediaPlayerType:MediaPlayerTypeMulti];
multiPlayerViewController.title = DemoNonLocalizedString(@"Multi-stream");
multiPlayerViewController.tabBarItem.image = [UIImage imageNamed:@"screen"];
MediasViewController *multiPlayerViewController = [[MediasViewController alloc] initWithTitle:DemoNonLocalizedString(@"Multi-stream") configurationFileName:@"MultiPlayerDemoConfiguration" mediaPlayerType:MediaPlayerTypeMulti];
UINavigationController *multiPlayerNavigationController = [[UINavigationController alloc] initWithRootViewController:multiPlayerViewController];
multiPlayerNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:DemoNonLocalizedString(@"Multi-stream") image:[UIImage imageNamed:@"multiplayer"] tag:2];

MediasViewController *audiosViewController = [[MediasViewController alloc] initWithConfigurationFileName:@"AudioDemoConfiguration" mediaPlayerType:MediaPlayerTypeStandard];
audiosViewController.title = DemoNonLocalizedString(@"Audios");
audiosViewController.tabBarItem.image = [UIImage imageNamed:@"audios"];
MediasViewController *audiosViewController = [[MediasViewController alloc] initWithTitle:DemoNonLocalizedString(@"Audios") configurationFileName:@"AudioDemoConfiguration" mediaPlayerType:MediaPlayerTypeStandard];
UINavigationController *audiosNavigationController = [[UINavigationController alloc] initWithRootViewController:audiosViewController];
audiosNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:DemoNonLocalizedString(@"Audios") image:[UIImage imageNamed:@"audios"] tag:3];

tabBarController.viewControllers = @[videosNavigationController, segmentsNavigationController, multiPlayerNavigationController, audiosNavigationController];
self.window.rootViewController = tabBarController;

// Avoid applying tint color to tab bar images
[tabBarController.viewControllers enumerateObjectsUsingBlock:^(UIViewController * _Nonnull viewController, NSUInteger idx, BOOL * _Nonnull stop) {
UITabBarItem *tabBarItem = viewController.tabBarItem;
tabBarItem.image = [tabBarItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tabBarItem.selectedImage = [tabBarItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}];

return YES;
}

Expand Down
2 changes: 1 addition & 1 deletion Demo/Sources/Medias/MediasViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef NS_ENUM(NSInteger, MediaPlayerType) {

@interface MediasViewController : UITableViewController

- (instancetype)initWithConfigurationFileName:(NSString *)configurationFileName mediaPlayerType:(MediaPlayerType)mediaPlayerType;
- (instancetype)initWithTitle:(NSString *)title configurationFileName:(NSString *)configurationFileName mediaPlayerType:(MediaPlayerType)mediaPlayerType;

@end

Expand Down
22 changes: 20 additions & 2 deletions Demo/Sources/Medias/MediasViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
#import "MultiPlayerViewController.h"
#import "NSBundle+Demo.h"
#import "SegmentsPlayerViewController.h"
#import "UIWindow+SRGMediaPlayer.h"

#import <AVKit/AVKit.h>
#import <SRGMediaPlayer/SRGMediaPlayer.h>

@interface MediasViewController ()
@interface MediasViewController () <AVPlayerViewControllerDelegate>

@property (nonatomic, copy) NSString *configurationFileName;

Expand All @@ -32,10 +33,11 @@ @implementation MediasViewController

#pragma mark Object lifecycle

- (instancetype)initWithConfigurationFileName:(NSString *)configurationFileName mediaPlayerType:(MediaPlayerType)mediaPlayerType
- (instancetype)initWithTitle:(NSString *)title configurationFileName:(NSString *)configurationFileName mediaPlayerType:(MediaPlayerType)mediaPlayerType
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:NSStringFromClass(self.class) bundle:nil];
MediasViewController *viewController = [storyboard instantiateInitialViewController];
viewController.title = title;
viewController.configurationFileName = configurationFileName;

switch (mediaPlayerType) {
Expand Down Expand Up @@ -81,6 +83,16 @@ - (void)viewDidLoad
return _medias;
}

#pragma mark AVPlayerViewControllerDelegate protocol

- (void)playerViewController:(AVPlayerViewController *)playerViewController restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:(void (^)(BOOL))completionHandler
{
UIViewController *topViewController = UIApplication.sharedApplication.keyWindow.srg_topViewController;
[topViewController presentViewController:playerViewController animated:YES completion:^{
completionHandler(YES);
}];
}

#pragma mark UITableViewDataSource protocol

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
Expand Down Expand Up @@ -144,11 +156,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
if (mediaPlayer.playerClass == SRGMediaPlayerViewController.class) {
SRGMediaPlayerViewController *mediaPlayerViewController = [[SRGMediaPlayerViewController alloc] init];
mediaPlayerViewController.controller.view.viewMode = media.is360 ? SRGMediaPlayerViewModeMonoscopic : SRGMediaPlayerViewModeFlat;
mediaPlayerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[mediaPlayerViewController.controller playURL:media.URL];
[self presentViewController:mediaPlayerViewController animated:YES completion:nil];
}
else if (mediaPlayer.playerClass == AVPlayerViewController.class) {
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
playerViewController.delegate = self;
AVPlayer *player = [AVPlayer playerWithURL:media.URL];
playerViewController.player = player;
[self presentViewController:playerViewController animated:YES completion:^{
Expand All @@ -157,14 +171,17 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}
else if (mediaPlayer.playerClass == InlinePlayerViewController.class) {
InlinePlayerViewController *inlinePlayerViewController = [[InlinePlayerViewController alloc] initWithMedia:media];
inlinePlayerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self.navigationController pushViewController:inlinePlayerViewController animated:YES];
}
else if (mediaPlayer.playerClass == CustomPlayerViewController.class) {
CustomPlayerViewController *customPlayerViewController = [[CustomPlayerViewController alloc] initWithMedia:media];
customPlayerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:customPlayerViewController animated:YES completion:nil];
}
else if (mediaPlayer.playerClass == SegmentsPlayerViewController.class) {
SegmentsPlayerViewController *segmentsPlayerViewController = [[SegmentsPlayerViewController alloc] initWithMedia:media];
segmentsPlayerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:segmentsPlayerViewController animated:YES completion:nil];
}
else if (mediaPlayer.playerClass == MultiPlayerViewController.class) {
Expand All @@ -173,6 +190,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[medias insertObject:media atIndex:0];

MultiPlayerViewController *segmentsPlayerViewController = [[MultiPlayerViewController alloc] initWithMedias:[medias copy]];
segmentsPlayerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:segmentsPlayerViewController animated:YES completion:nil];
}
}
Expand Down
16 changes: 8 additions & 8 deletions Demo/Sources/Medias/MediasViewController.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Jjf-e5-XBk">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Jjf-e5-XBk">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -16,20 +16,20 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="JdY-Zl-eDl">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="checkmark" indentationWidth="10" reuseIdentifier="MediaCell" textLabel="NSE-T5-Uaf" style="IBUITableViewCellStyleDefault" id="Vxq-9n-0ot">
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Vxq-9n-0ot" id="HE7-ht-qbO">
<rect key="frame" x="0.0" y="0.0" width="336" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="335" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Media Cell" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="NSE-T5-Uaf">
<rect key="frame" x="16" y="0.0" width="320" height="43.5"/>
<rect key="frame" x="16" y="0.0" width="319" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
Expand All @@ -39,14 +39,14 @@
<rect key="frame" x="0.0" y="99.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="rhk-Th-wEG" id="6K5-SR-iah">
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Player Cell" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Vzo-N4-jR4">
<rect key="frame" x="16" y="0.0" width="324" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
Expand Down
Loading

0 comments on commit e358834

Please sign in to comment.