Skip to content

Commit

Permalink
Merge branch 'release/2.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Sep 28, 2018
2 parents b793c74 + fe172ed commit 6134824
Show file tree
Hide file tree
Showing 73 changed files with 728 additions and 576 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*.xcscmblueprint
xcuserdata

archive
build
/archive
/build

Carthage
/Carthage

fastlane/report.xml
fastlane/test_output
/fastlane/report.xml
/fastlane/test_output
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "SRGSSR/libextobjc" "0.6_srg1"
github "SRGSSR/MAKVONotificationCenter" "1.0_srg2"
github "SRGSSR/srglogger-ios" "1.0.6"
github "SRGSSR/srglogger-ios" "1.0.7"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "SRGSSR/MAKVONotificationCenter" "1.0_srg2"
github "SRGSSR/libextobjc" "0.6_srg1"
github "SRGSSR/srglogger-ios" "1.0.6"
github "SRGSSR/srglogger-ios" "1.0.7"
2 changes: 1 addition & 1 deletion Demo/Resources/MultiPlayerDemoConfiguration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<key>name</key>
<string>Gotthard 360</string>
<key>url</key>
<string>https://rtsvodww-vh.akamaihd-staging.net/i/360/2017/Gothard_360_full_f_8414077-,301k,701k,1201k,2001k,.mp4.csmil/master.m3u8?__b__=2000</string>
<string>https://rtsvodww-vh.akamaihd.net/i/360/2017/2_Gothard_360_full_f_8414077-,301k,701k,1201k,2001k,.mp4.csmil/master.m3u8</string>
<key>is360</key>
<true/>
</dict>
Expand Down
33 changes: 33 additions & 0 deletions Demo/Resources/SegmentDemoConfiguration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,39 @@
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>Segments in DVR stream</string>
<key>url</key>
<string>http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8</string>
<key>segments</key>
<array>
<dict>
<key>name</key>
<string>Segment #0</string>
<key>startTime</key>
<integer>5000</integer>
<key>duration</key>
<integer>10000</integer>
</dict>
<dict>
<key>name</key>
<string>Segment #1</string>
<key>startTime</key>
<integer>30000</integer>
<key>duration</key>
<integer>10000</integer>
</dict>
<dict>
<key>name</key>
<string>Segment #2</string>
<key>startTime</key>
<integer>55000</integer>
<key>duration</key>
<integer>10000</integer>
</dict>
</array>
</dict>
</array>
</dict>
</plist>
15 changes: 0 additions & 15 deletions Demo/Resources/TimeshiftDemoConfiguration.plist

This file was deleted.

8 changes: 7 additions & 1 deletion Demo/Resources/VideoDemoConfiguration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<key>url</key>
<string>http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8?dw=0</string>
</dict>
<dict>
<key>name</key>
<string>Livestream with DVR</string>
<key>url</key>
<string>http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8</string>
</dict>
<dict>
<key>name</key>
<string>Apple Basic Stream</string>
Expand Down Expand Up @@ -62,7 +68,7 @@
<key>name</key>
<string>Gotthard 360 video</string>
<key>url</key>
<string>https://rtsvodww-vh.akamaihd-staging.net/i/360/2017/Gothard_360_full_f_8414077-,301k,701k,1201k,2001k,.mp4.csmil/master.m3u8?__b__=2000</string>
<string>https://rtsvodww-vh.akamaihd.net/i/360/2017/2_Gothard_360_full_f_8414077-,301k,701k,1201k,2001k,.mp4.csmil/master.m3u8</string>
<key>is360</key>
<true/>
</dict>
Expand Down
25 changes: 10 additions & 15 deletions Demo/Sources/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ - (UIImage *)tintedImageWithColor:(UIColor *)color
if (! color) {
return self;
}

CGRect rect = CGRectMake(0.f, 0.f, self.size.width, self.size.height);
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.f);
CGContextRef context = UIGraphicsGetCurrentContext();

CGContextTranslateCTM(context, 0.f, self.size.height);
CGContextScaleCTM(context, 1.0f, -1.f);

CGContextDrawImage(context, rect, self.CGImage);
CGContextSetBlendMode(context, kCGBlendModeSourceIn);
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, rect);

UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

return tintedImage;
}

Expand All @@ -50,10 +50,10 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor blackColor];
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.window.backgroundColor = UIColor.blackColor;
[self.window makeKeyAndVisible];

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];

UITabBarController *tabBarController = [[UITabBarController alloc] init];
Expand All @@ -73,17 +73,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
multiPlayerViewController.tabBarItem.image = [UIImage imageNamed:@"screen"];
UINavigationController *multiPlayerNavigationController = [[UINavigationController alloc] initWithRootViewController:multiPlayerViewController];

MediasViewController *timeshiftViewController = [[MediasViewController alloc] initWithConfigurationFileName:@"TimeshiftDemoConfiguration" mediaPlayerType:MediaPlayerTypeTimeshift];
timeshiftViewController.title = DemoNonLocalizedString(@"Timeshift");
timeshiftViewController.tabBarItem.image = [UIImage imageNamed:@"videos"];
UINavigationController *timeshiftNavigationController = [[UINavigationController alloc] initWithRootViewController:timeshiftViewController];

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

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

// Avoid applying tint color to tab bar images
Expand All @@ -92,7 +87,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
tabBarItem.image = [tabBarItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tabBarItem.selectedImage = [tabBarItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}];

return YES;
}

Expand Down
6 changes: 3 additions & 3 deletions Demo/Sources/Application/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass(AppDelegate.class));
}
}
1 change: 0 additions & 1 deletion Demo/Sources/Medias/MediasViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, MediaPlayerType) {
MediaPlayerTypeStandard,
MediaPlayerTypeSegments,
MediaPlayerTypeTimeshift,
MediaPlayerTypeMulti
};

Expand Down
34 changes: 15 additions & 19 deletions Demo/Sources/Medias/MediasViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

#import "MediasViewController.h"

#import "CustomPlayerViewController.h"
#import "InlinePlayerViewController.h"
#import "Media.h"
#import "MediaPlayer.h"
#import "MultiPlayerViewController.h"
#import "NSBundle+Demo.h"
#import "SegmentsPlayerViewController.h"
#import "TimeshiftPlayerViewController.h"

#import <AVKit/AVKit.h>
#import <SRGMediaPlayer/SRGMediaPlayer.h>
Expand Down Expand Up @@ -40,24 +40,20 @@ - (instancetype)initWithConfigurationFileName:(NSString *)configurationFileName

switch (mediaPlayerType) {
case MediaPlayerTypeStandard: {
viewController.mediaPlayers = @[ [MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"SRG media player") class:[SRGMediaPlayerViewController class]],
[MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"iOS media player") class:[AVPlayerViewController class]],
[MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"Inline SRG player") class:[InlinePlayerViewController class]] ];
viewController.mediaPlayers = @[ [MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"SRG media player (built-in design)") class:SRGMediaPlayerViewController.class],
[MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"iOS media player") class:AVPlayerViewController.class],
[MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"Inline player") class:InlinePlayerViewController.class],
[MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"Custom player") class:CustomPlayerViewController.class] ];
break;
}

case MediaPlayerTypeSegments: {
viewController.mediaPlayers = @[ [MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"SRG player with segments support") class:[SegmentsPlayerViewController class]] ];
break;
}

case MediaPlayerTypeTimeshift: {
viewController.mediaPlayers = @[ [MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"SRG player with timeshift support") class:[TimeshiftPlayerViewController class]] ];
viewController.mediaPlayers = @[ [MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"Player with segments support") class:SegmentsPlayerViewController.class] ];
break;
}

case MediaPlayerTypeMulti: {
viewController.mediaPlayers = @[ [MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"Multi player") class:[MultiPlayerViewController class]] ];
viewController.mediaPlayers = @[ [MediaPlayer mediaPlayerWithName:DemoNonLocalizedString(@"Multi player") class:MultiPlayerViewController.class] ];
break;
}
}
Expand Down Expand Up @@ -145,33 +141,33 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}

MediaPlayer *mediaPlayer = self.mediaPlayers[indexPath.row];
if (mediaPlayer.playerClass == [SRGMediaPlayerViewController class]) {
if (mediaPlayer.playerClass == SRGMediaPlayerViewController.class) {
SRGMediaPlayerViewController *mediaPlayerViewController = [[SRGMediaPlayerViewController alloc] init];
mediaPlayerViewController.controller.view.viewMode = media.is360 ? SRGMediaPlayerViewModeMonoscopic : SRGMediaPlayerViewModeFlat;
[mediaPlayerViewController.controller playURL:media.URL];
[self presentViewController:mediaPlayerViewController animated:YES completion:nil];
}
else if (mediaPlayer.playerClass == [AVPlayerViewController class]) {
else if (mediaPlayer.playerClass == AVPlayerViewController.class) {
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
AVPlayer *player = [AVPlayer playerWithURL:media.URL];
playerViewController.player = player;
[self presentViewController:playerViewController animated:YES completion:^{
[player play];
}];
}
else if (mediaPlayer.playerClass == [InlinePlayerViewController class]) {
else if (mediaPlayer.playerClass == InlinePlayerViewController.class) {
InlinePlayerViewController *inlinePlayerViewController = [[InlinePlayerViewController alloc] initWithMedia:media];
[self.navigationController pushViewController:inlinePlayerViewController animated:YES];
}
else if (mediaPlayer.playerClass == [TimeshiftPlayerViewController class]) {
TimeshiftPlayerViewController *timeshiftPlayerViewController = [[TimeshiftPlayerViewController alloc] initWithMedia:media];
[self presentViewController:timeshiftPlayerViewController animated:YES completion:nil];
else if (mediaPlayer.playerClass == CustomPlayerViewController.class) {
CustomPlayerViewController *customPlayerViewController = [[CustomPlayerViewController alloc] initWithMedia:media];
[self presentViewController:customPlayerViewController animated:YES completion:nil];
}
else if (mediaPlayer.playerClass == [SegmentsPlayerViewController class]) {
else if (mediaPlayer.playerClass == SegmentsPlayerViewController.class) {
SegmentsPlayerViewController *segmentsPlayerViewController = [[SegmentsPlayerViewController alloc] initWithMedia:media];
[self presentViewController:segmentsPlayerViewController animated:YES completion:nil];
}
else if (mediaPlayer.playerClass == [MultiPlayerViewController class]) {
else if (mediaPlayer.playerClass == MultiPlayerViewController.class) {
NSMutableArray *medias = [self.medias mutableCopy];
[medias removeObject:media];
[medias insertObject:media atIndex:0];
Expand Down
2 changes: 1 addition & 1 deletion Demo/Sources/Models/MediaPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ @implementation MediaPlayer

+ (MediaPlayer *)mediaPlayerWithName:(NSString *)name class:(Class)playerClass
{
return [[[self class] alloc] initWithName:name class:playerClass];
return [[self.class alloc] initWithName:name class:playerClass];
}

- (instancetype)initWithName:(NSString *)name class:(Class)playerClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

NS_ASSUME_NONNULL_BEGIN

@interface TimeshiftPlayerViewController : UIViewController
@interface CustomPlayerViewController : UIViewController

- (instancetype)initWithMedia:(Media *)media;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
// License information is available from the LICENSE file.
//

#import "TimeshiftPlayerViewController.h"
#import "CustomPlayerViewController.h"

#import "NSBundle+Demo.h"
#import "SegmentCollectionViewCell.h"

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

@interface TimeshiftPlayerViewController ()
@interface CustomPlayerViewController ()

@property (nonatomic) IBOutlet SRGMediaPlayerController *mediaPlayerController;

Expand All @@ -26,14 +26,14 @@ @interface TimeshiftPlayerViewController ()

@end

@implementation TimeshiftPlayerViewController
@implementation CustomPlayerViewController

#pragma mark Object lifecycle

- (instancetype)initWithMedia:(Media *)media
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:NSStringFromClass(self.class) bundle:nil];
TimeshiftPlayerViewController *viewController = [storyboard instantiateInitialViewController];
CustomPlayerViewController *viewController = [storyboard instantiateInitialViewController];
viewController.media = media;
return viewController;
}
Expand All @@ -46,12 +46,12 @@ - (void)viewDidLoad

[self.liveButton setTitle:DemoNonLocalizedString(@"Back to live") forState:UIControlStateNormal];
self.liveButton.alpha = 0.f;

self.liveButton.layer.borderColor = [UIColor whiteColor].CGColor;
self.liveButton.layer.borderColor = UIColor.whiteColor.CGColor;
self.liveButton.layer.borderWidth = 1.f;

self.mediaPlayerController.view.viewMode = self.media.is360 ? SRGMediaPlayerViewModeMonoscopic : SRGMediaPlayerViewModeFlat;

@weakify(self)
[self.mediaPlayerController addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(1., NSEC_PER_SEC) queue:NULL usingBlock:^(CMTime time) {
@strongify(self)
Expand All @@ -64,7 +64,7 @@ - (void)viewDidLoad
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

if ([self isMovingToParentViewController] || [self isBeingPresented]) {
[self.mediaPlayerController playURL:self.media.URL];
}
Expand Down Expand Up @@ -96,7 +96,7 @@ - (IBAction)goToLive:(id)sender
[UIView animateWithDuration:0.2 animations:^{
self.liveButton.alpha = 0.f;
}];

CMTimeRange timeRange = self.mediaPlayerController.timeRange;
if (CMTIMERANGE_IS_INDEFINITE(timeRange) || CMTIMERANGE_IS_EMPTY(timeRange)) {
return;
Expand Down
Loading

0 comments on commit 6134824

Please sign in to comment.