Skip to content

Commit

Permalink
Merge branch 'release/6.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Nov 24, 2020
2 parents 7a89c2d + ad5dd85 commit a0f1922
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Stack trace or log information
> The simulator is a valid device as well. If all versions or devices seem to be affected, simply enter 'Any'
* Library version: _version_
* iOS version: _version_
* iOS / tvOS version: _version_
* Device: _model_

### Reproducibility
Expand Down
2 changes: 1 addition & 1 deletion Demo/Demo.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version information
MARKETING_VERSION = 6.0.0
MARKETING_VERSION = 6.1.0

// Deployment targets
IPHONEOS_DEPLOYMENT_TARGET = 9.0
Expand Down
10 changes: 5 additions & 5 deletions Demo/Resources/Data/AudioDemoConfiguration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@
</dict>
<dict>
<key>name</key>
<string>SRF 1 DVR mp3</string>
<string>SRF 1 HLS DVR</string>
<key>url</key>
<string>http://lsaplus.swisstxt.ch/audio/drs1_96.stream/playlist.m3u8</string>
</dict>
<dict>
<key>name</key>
<string>SRF 2 Livestream mp3</string>
<string>La 1ère HLS DVR</string>
<key>url</key>
<string>http://streaming.swisstxt.ch/m/drs2/mp3_128</string>
<string>http://lsaplus.swisstxt.ch/audio/rsp_96.stream/playlist.m3u8</string>
</dict>
<dict>
<key>name</key>
<string>Timeshift</string>
<string>SRF 2 Livestream mp3</string>
<key>url</key>
<string>http://lsaplus.swisstxt.ch/audio/rsp_96.stream/playlist.m3u8</string>
<string>http://streaming.swisstxt.ch/m/drs2/mp3_128</string>
</dict>
</array>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion Demo/Resources/Data/MultiPlayerDemoConfiguration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</dict>
<dict>
<key>name</key>
<string>Gotthard 360</string>
<string>Gothard 360</string>
<key>url</key>
<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>
Expand Down
16 changes: 8 additions & 8 deletions Demo/Resources/Data/SegmentDemoConfiguration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<key>name</key>
<string>3 non-consecutive segments</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand Down Expand Up @@ -41,7 +41,7 @@
<key>name</key>
<string>One blocked segment</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand All @@ -60,7 +60,7 @@
<key>name</key>
<string>One hidden segment</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand All @@ -79,7 +79,7 @@
<key>name</key>
<string>One blocked hidden segment</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand All @@ -100,7 +100,7 @@
<key>name</key>
<string>Segment at start</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand All @@ -119,7 +119,7 @@
<key>name</key>
<string>Blocked segment at start</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand All @@ -138,7 +138,7 @@
<key>name</key>
<string>Five consecutive segments</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand Down Expand Up @@ -187,7 +187,7 @@
<key>name</key>
<string>Two consecutive blocked segments</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<key>segments</key>
<array>
<dict>
Expand Down
8 changes: 4 additions & 4 deletions Demo/Resources/Data/VideoDemoConfiguration.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<key>name</key>
<string>Apple Basic Stream</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8</string>
</dict>
<dict>
<key>name</key>
<string>Apple Advanced Stream</string>
<key>url</key>
<string>http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
<string>https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</string>
</dict>
<dict>
<key>name</key>
Expand Down Expand Up @@ -84,7 +84,7 @@
</dict>
<dict>
<key>name</key>
<string>Gotthard 360° video</string>
<string>Gothard 360° video</string>
<key>url</key>
<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>
Expand All @@ -102,7 +102,7 @@
<key>name</key>
<string>10vor10 subject with buggy subtitles (Akamai issue)</string>
<key>url</key>
<string>https://srfvodhd-vh.akamaihd.net/i/vod/10vor10/2020/02/10vor10_20200226_215000_19794538_v_webcast_h264_,q40,q10,q20,q30,q50,q60,.mp4.csmil/master.m3u8?start=527.04&amp;end=687.56&amp;caption=srf%2F7a4a3dd2-f470-4eab-af9a-efd9dbaad345%2Fepisode%2Fde%2Fvod%2Fvod.m3u8:de:Deutsch:sdh&amp;webvttbaseurl=www.srf.ch%2Fsubtitles</string>
<string>https://hdvodsrforigins3-vh.akamaihd.net/i/assets/video/10vor10/2020/06/10vor10_20200610_215034_21058070_v_webcast_h264_,q40,q10,q20,q30,q50,.mp4.csmil/master.m3u8?start=66.4&amp;end=554.52&amp;caption=srf%2F26a1de9a-7b3e-460f-a3c2-24421b00217a%2Fepisode%2Fde%2Fvod%2Fvod.m3u8%3Ade%3ADeutsch%3Asdh&amp;webvttbaseurl=www.srf.ch%2Fsubtitles</string>
</dict>
<dict>
<key>name</key>
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription

struct ProjectSettings {
static let marketingVersion: String = "6.0.0"
static let marketingVersion: String = "6.1.0"
}

let package = Package(
Expand Down
1 change: 1 addition & 0 deletions Sources/SRGMediaPlayer/SRGMediaPlayerConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
NSString * const SRGMediaPlayerInterruptionKey = @"SRGMediaPlayerInterruption";

NSString * const SRGMediaPlayerSelectionKey = @"SRGMediaPlayerSelection";
NSString * const SRGMediaPlayerSelectionReasonKey = @"SRGMediaPlayerSelectionReason";

NSString * const SRGMediaPlayerTrackKey = @"SRGMediaPlayerTrack";
NSString * const SRGMediaPlayerPreviousTrackKey = @"SRGMediaPlayerPreviousTrack";
Expand Down
22 changes: 19 additions & 3 deletions Sources/SRGMediaPlayer/SRGMediaPlayerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ @interface SRGMediaPlayerController () <SRGMediaPlayerViewDelegate, SRGPlayerDel
@property (nonatomic) SRGPosition *initialPosition;

@property (nonatomic, weak) id<SRGSegment> previousSegment;
@property (nonatomic, weak) id<SRGSegment> targetSegment; // Will be nilled when reached
@property (nonatomic, weak) id<SRGSegment> currentSegment;

@property (nonatomic, weak) id<SRGSegment> targetSegment; // Will be nilled when reached
@property (nonatomic) SRGMediaPlayerSelectionReason selectionReason;

@property (nonatomic) AVPictureInPictureController *pictureInPictureController API_AVAILABLE(ios(9.0), tvos(14.0));
@property (nonatomic, copy) void (^pictureInPictureControllerCreationBlock)(AVPictureInPictureController *pictureInPictureController) API_AVAILABLE(ios(9.0), tvos(14.0));
@property (nonatomic) NSNumber *savedAllowsExternalPlayback;
Expand Down Expand Up @@ -351,7 +353,12 @@ - (void)setPlaybackState:(SRGMediaPlayerPlaybackState)playbackState withUserInfo

NSMutableDictionary *fullUserInfo = @{ SRGMediaPlayerPlaybackStateKey : @(playbackState),
SRGMediaPlayerPreviousPlaybackStateKey: @(previousPlaybackState) }.mutableCopy;
fullUserInfo[SRGMediaPlayerSelectionKey] = @(self.targetSegment && ! self.targetSegment.srg_blocked);

BOOL selection = self.targetSegment && ! self.targetSegment.srg_blocked;
fullUserInfo[SRGMediaPlayerSelectionKey] = @(selection);
if (selection) {
fullUserInfo[SRGMediaPlayerSelectionReasonKey] = @(self.selectionReason);
}
if (userInfo) {
[fullUserInfo addEntriesFromDictionary:userInfo];
}
Expand Down Expand Up @@ -1201,7 +1208,9 @@ - (void)prepareToPlayURLAsset:(AVURLAsset *)URLAsset

self.loadedSegments = segments;
self.userInfo = userInfo;

self.targetSegment = targetSegment;
self.selectionReason = SRGMediaPlayerSelectionReasonInitial;

// Save initial values for restart after a stop
self.initialTargetSegment = targetSegment;
Expand Down Expand Up @@ -1249,6 +1258,7 @@ - (void)seekToPosition:(SRGPosition *)position inTargetSegment:(id<SRGSegment>)t
}

self.targetSegment = targetSegment;
self.selectionReason = SRGMediaPlayerSelectionReasonUpdate;

SRGTimePosition *timePosition = [self timePositionForPosition:position inSegment:targetSegment applyEndTolerance:NO];

Expand Down Expand Up @@ -1308,8 +1318,8 @@ - (void)stopWithUserInfo:(NSDictionary *)userInfo
self.playbackInformationCached = NO;

self.previousSegment = nil;
self.targetSegment = nil;
self.currentSegment = nil;
self.targetSegment = nil;

self.startPosition = nil;
self.startCompletionHandler = nil;
Expand Down Expand Up @@ -1515,6 +1525,9 @@ - (void)processTransitionToSegment:(id<SRGSegment>)segment selected:(BOOL)select
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[SRGMediaPlayerSegmentKey] = self.previousSegment;
userInfo[SRGMediaPlayerSelectionKey] = @(selected);
if (selected) {
userInfo[SRGMediaPlayerSelectionReasonKey] = @(self.selectionReason);
}
userInfo[SRGMediaPlayerSelectedKey] = @(_selected);
userInfo[SRGMediaPlayerInterruptionKey] = @(interrupted);
userInfo[SRGMediaPlayerLastPlaybackTimeKey] = [NSValue valueWithCMTime:lastPlaybackTime];
Expand All @@ -1541,6 +1554,9 @@ - (void)processTransitionToSegment:(id<SRGSegment>)segment selected:(BOOL)select
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[SRGMediaPlayerSegmentKey] = segment;
userInfo[SRGMediaPlayerSelectionKey] = @(_selected);
if (_selected) {
userInfo[SRGMediaPlayerSelectionReasonKey] = @(self.selectionReason);
}
userInfo[SRGMediaPlayerSelectedKey] = @(_selected);
userInfo[SRGMediaPlayerLastPlaybackTimeKey] = [NSValue valueWithCMTime:lastPlaybackTime];
userInfo[SRGMediaPlayerLastPlaybackDateKey] = lastPlaybackDate;
Expand Down
9 changes: 9 additions & 0 deletions Sources/SRGMediaPlayer/include/SRGMediaPlayerConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ typedef NS_ENUM(NSInteger, SRGMediaPlayerPlaybackState) {
SRGMediaPlayerPlaybackStateEnded
};

/**
* Reasons for segment selection.
*/
typedef NS_ENUM(NSInteger, SRGMediaPlayerSelectionReason) {
SRGMediaPlayerSelectionReasonInitial = 1, // Initial selection at playback start
SRGMediaPlayerSelectionReasonUpdate // Selection update during playback
};

/**
* User interface styles, for compatibility with `UIUserInterfaceStyle` on iOS 11 and below.
*/
Expand Down Expand Up @@ -266,6 +274,7 @@ OBJC_EXPORT NSString * const SRGMediaPlayerInterruptionKey;
* Information available for `SRGMediaPlayerSegmentDidStartNotification`, `SRGMediaPlayerSegmentDidEndNotification` and `SRGMediaPlayerPlaybackStateDidChangeNotification`.
*/
OBJC_EXPORT NSString * const SRGMediaPlayerSelectionKey; // Key to an `NSNumber` wrapping a boolean, set to `YES` iff the notification results from a segment selection.
OBJC_EXPORT NSString * const SRGMediaPlayerSelectionReasonKey; // Key to an `NSNumber` wrapping a `SRGMediaPlayerSelectionReason`, specifying the reason selection was made.

/**
* Information available for `SRGMediaPlayerAudioTrackDidChangeNotification` and `SRGMediaPlayerSubtitleTrackDidChangeNotification`.
Expand Down
Loading

0 comments on commit a0f1922

Please sign in to comment.