Swiftpack.co - Package - SRGSSR/srgmediaplayer-apple

404: Not Found


Stars: 119

Used By

Total: 0


Reason for segment selection -

  • In segment and playback notifications, the reason why segment selection occurred is now provided. See SRGMediaPlayerSelectionReason.

Swift Package Manager, Catalyst support and tvOS picture in picture -

Improved iOS and tvOS 14 compatibility

This release improves compatibility with iOS and tvOS 14, most notably:

  • The time slider appearance has been fixed when displayed on a modal with a custom transition animation.
  • A potential route detection deadlock has been fixed.
  • Picture in picture is available for tvOS.

Note that background video playback does not work on iOS 14.0 and 14.1 because of an iOS bug. This bug will be fixed in iOS 14.2 without requiring any SRG Media Player update.

iOS 14 emergency compatibility -

Apple took us by surprise this year. We had reported an iOS 14 regression (player leak due to PiP changes in iOS 14), but this bug was not addressed and iOS 14 released. As a result, playing a video on iOS 14 with SRGMediaPlayerController is internally leaking an AVPlayer instance for reasons outside our control.

This release provides a workaround for this issue until we can discuss with Apple about it (if we ever can). It first internally presents an invisible AVPlayerViewController instance, which magically fixes the issue.

About Xcode 12 support

A proper iOS / tvOS 14 release will be made later. Until then, we recommend you ship your application with Xcode 11.7 if you can. The library can be compiled with Xcode 12 but has not been fully tested yet.

If you still intend to use Xcode 12, note there is an issue with Carthage with a workaround available. The next official release we will deliver will support Xcode 12 and replace Carthage with SPM.

Known issues

iOS 14 breaks background video playback support. This is either desired behavior or a regression. Until we know more the API will be kept as is but will not produce the expected behavior (video playback is paused when transitioning to the background, even if the player layer is detached).

Finally, note that picture in picture is not working for tvOS 14 yet. This feature is planned for a later release.

Maintenance release -

  • Mitigate a possible crash when playback fails for some reason.

Maintenance release -

  • Fix stall detection, avoiding the controller to sometimes stay stuck in this state.
  • Avoid screen dimming when playing a video with sound routed over AirPlay.
  • Correctly take into account SDH accessibility opt-in when choosing subtitles automatically.

Date support for livestreams -

Date support

This release adds support for dates when playing a livestream:

  • When playing a livestream, the currentDate property of SRGMediaPlayerController provides the date corresponding to the current position, if any.
  • For livestreams the player can equivalently start playback or seek to time or date-based positions. New SRGMark and SRGMarkRange classes have been introduced to support this duality.
  • (Breaking change) To support the time / date duality, segments are not defined anymore with time ranges, but with mark ranges. The previously required -srg_timeRange property has therefore been replaced with -srg_markRange.
  • (Breaking change) SRGTimeSliderDelegate methods receive an optional date parameter. Be sure your implementation adopt the new method signatures.

This feature works best if date information is supplied in the streams themselves with EXT-X-PROGRAM-DATE-TIME tags. This ensures that the stream time and the wall-clock time can be related. If no such information is available in your streams you can still use date-based seeking, but accuracy might not be optimal (there is a delay between broadcasting and streaming). To mitigate this issue, you can measure which delay there is between broadcasting and streaming, and provide a SRGMediaPlayerUserInfoStreamOffsetKey as userInfo when playing your stream.


  • Ensure the player prevents the device from sleeping only when required. For video background playback proper behavior requires a device supporting iOS 12 or above.
  • Fix imprecise seeks when a Bluetooth handset is connected.
  • Fix issue preventing the player from correctly resuming when seeking outside the available media range.
  • Fix tvOS build issue with Xcode 11.4.

Audio track and subtitle support improvements -

Audio tracks and subtitle support

Audio track and subtitle support has been greatly improved to be more consistent and user-friendly.

iOS and tvOS

  • Default audio selection now takes the application language into account, as well as user preferred languages. For example, if an application is only translated in French but offers content with French and English audio, the default language is now French. Previously, this depended only on user preferred languages and could be English if the user preferred language was English, even though the application was available in French only.
  • Automatic subtitle selection works as it should. It now correctly automatically enables subtitles if the audio is not a language the user is supposed to understand, but that subtitles the user can understand are available (based on app and system preferred languages).
  • Media configuration could be made programatically by assigning a block to the mediaConfigurationBlock. This single block has been replaced with two specific audioConfigurationBlock and subtitleConfigurationBlock blocks. Refer to the updated documentation to see how these blocks should be implemented so that you can update your code appropriately.
  • Subtitle styling was previously made with the mediaConfigurationBlock. It must now be made with the new dedicated textStyleRules controller property.
  • The -reloadMediaConfigurationWithBlock: and -reloadPlayerConfigurationWithBlock: controller methods have been removed. If you need to update a configuration block and apply the changes, update the associated block property and call -reloadMediaConfiguration or -reloadPlayerConfiguration afterwards.

iOS only

  • Audio track and subtitle choices are correctly preserved when casting over AirPlay and not overridden by the receiver (e.g. Apple TV) anymore.
  • The audio track and subtitle user interface has been improved. The current choice is always displayed (even if not available for the specified content). Empty selection is not possible anymore (this was clearly misleading for users) and information to the user has been improved.
  • Empty subtitle tracks are now omitted. This avoids SRGTracksButton from being displayed when not needed, and eliminates dumb choices with no visible effect from the tracks popover altogether.

Other changes

A few fixes and improvements have been made as well.

iOS and tvOS

  • Player and UI component energy efficiency has been improved (the number of refreshes has been reduced). In particular, non-required background activity has been eliminated.

iOS only

  • SRGPlaybackButton can be assigned an optional delegate for action and accessibility customization if needed.
  • Picture in picture and AirPlay play along in a more natural way. When PiP is enabled, external playback is now prevented automatically (only audio might is routed to the receiver).
  • Documentation for PiP support has been improved. In particular, correct restoration requires a custom transition to be implemented which was previously not clearly stated. Refer to the documentation and examples for more information.

tvOS compatibility -

  • The library is compatible with tvOS.
  • Many properties are now key-value observable (e.g. timeRange or mediaType). If your implementation previously used periodic time observers to check these properties for changes, you should now simply respond to changes instead.
  • The AirPlay button now supports two different images for audio and video. The previously unique image property has been removed.
  • Semantic versioning has been adopted.
  • The project has been renamed as srgmediaplayer-apple.

iOS 13 support -

  • The project has been updated to support iOS 13 and Xcode 11.
  • The track selection interface has been updated:
    • Dark mode is supported on iOS 13 and above. A new userInterfaceStyle property for SRGTracksButton lets you choose whether the appearance is controlled by the system, or whether the track selection interface should always be displayed with a light or dark theme.
    • The track selection interface displays either as a popover or modal depending on the available screen width.
  • The SRGMediaPlayerViewController icons have been updated for a more consistent look & feel.
  • The SRGTracksButtonDelegate delegate methods have been renamed.

Maintenance release -

  • Tracks popover anchoring has been made more reliable.

Background video playback support -

  • Background video playback behavior can be finely controlled with the viewBackgroundBehavior controller property. If you want to allow lock screen playback on devices running iOS 12.3 and above (the standard behavior of SRGMediaPlayerController until version 2.6), use SRGMediaPlayerViewBackgroundBehaviorDetachedWhenDeviceLocked.
  • Fix an issue with Akamai streams containing subtitles when start and / or end times are provided (playback not ending correctly because of subtitles longer than the stream).
  • Route detection and AirPlay button layout performance have been improved on iOS 11 and above.

Improved subtitle support -

  • Support for subtitle selection has been improved to better take Accessibility settings (SDH / Audio description) into account, as well as user preferred languages.
  • A media configuration block can be optionally be attached to a media player controller. This block is called when a media is ready to play, and provides a convenient way to customize the AVPlayerItem before it is played. This block is mostly provided as a way to customize subtitle and audio tracks programatically (#64).
  • Playback methods which expected an AVPlayerItem object now expect an AVURLAsset object instead. Accordingly, the SRGMediaPlayerPreviousPlayerItemAssetKey constant has been renamed as SRGMediaPlayerPreviousURLAssetKey.
  • Player stalls are now reported in a reliable way.
  • Audio-only playback detection has been improved (#63).
  • A new SRGMediaPlayerPreviousSelectedSegmentKey is supplied in playback state change notifications to provide information about any previously selected segment.
  • The subtitle popover style cannot be overridden anymore with UIAppearance.
  • The framework footprint at application startup time has been reduced.

End of stream behavior fix -

This release fixes minor end of stream behavior regressions.

Improved subtitle support -

  • Subtitle support has been improved (#58):
    • The behavior of subtitle selection closely matches the one of the standard system player. Three modes are offered: Off, Automatic and explicit subtitle selection.
    • Provided subtitles are properly described in the stream, the current subtitle selection is saved and restored, as for AVPlayerViewController.

DVR livestream start fix -

  • When a livestream with DVR support takes a long time to load (e.g. on slow networks), the stream was incorrectly starting at the beginning of the DVR window, not at its end. This has been fixed.

Documentation update -

This release improves project documentation and does not introduce any code change.

iOS 12 SDK compatibility and fix for erratic DVR seeks -

  • Projects depending on SRG Media Player can now be built with Xcode 10 and the iOS 12 SDK. No playback issues will occur anymore.
  • An issue affecting seeks in DVR streams and introduced in version 2.5 has been fixed.
  • Framework dependencies were incorrectly embedded in the SRG Media Player Cocoa Touch framework since version 2.5. This issue, which was leading to iTunes Connect rejection when submitting binaries (duplicate binaries), has been fixed.

Fix iTunes Connect binary submission -

This release fixes a binary submission issue for applications delivered with bitcode.

⚠️This version has known issues when compiling with the iOS 12 SDK. Until these issues have been fixed, please compile your application with the iOS 11 SDK (which will then run fine on iOS 12).

Improved time support -

  • Times (CMTime) have been replaced by positions (SRGPosition) in all playback and seek methods. A position is just a time, but associated with tolerances to be applied when reaching it. For the default position, simply use nil as position.
  • The -seekEfficientlyToTime:withCompletionHandler: and -seekPreciselyToTime:withCompletionHandler: methods of SRGMediaPlayerController have been removed. Use +[SRGPosition positionAroundTime:] and +[SRGPosition positionAtTime:] to create corresponding positions, and use them with -seekToPosition:withCompletionHandler: instead.
  • A start position can be provided when playing a segment, or when seeking to it.
  • Previously, attempting to play some content at or past its end would start and almost immediately stop playback at the content end, which was making little sense. Attempting to start playback at or past its end now starts playback at the content default position (usually its start).
  • An optional tolerance can be defined for the end of a content, using the absolute endTolerance and / or its relative endToleranceRatio counterpart. If the playback start position falls within the tolerance defined by these values, playback will start at the content default position, as if the content was played after its end.
  • A typo in AirPlay has been fixed in class and method names, most notably:
    • SRGAirplayButtonSRGAirPlayButton and SRGAirplayViewSRGAirPlayView. Do not forget to update instances in storyboards and xib files.
    • The SRGAirPlayViewDelegate protocol and its methods. Be sure to update your code if you were previously implementing one of these delegate methods.
  • New CMTime and CMTimeRange macros are available for checking times and ranges.
  • To mitigate slow application startups usually associated with a large number of dynamic frameworks being used, static framework integration with Carthage 0.30 and above is now supported.
  • A Makefile has been added to conveniently build and package the project.

⚠️This version has known issues when compiling with the iOS 12 SDK. Until these issues have been fixed, please compile your application with the iOS 11 SDK (which will then run fine on iOS 12).

Maintenance release -

  • This release fixes incorrect URL notification information when an AVPlayerItem is played.

Maintenance release -

This version updates dependencies the library relies on.

Update with Xcode 9.4 -

This version modernizes the project with Xcode 9.4.

Improved track titles -

The track titles displayed in the subtitles and audio channel selection popover have been improved.

Control fixes -

  • The SRGTimeSlider borderColor property has been removed, as having a border color was never really useful (sliders with a border color were ultimately ugly). All tracks (elapsed time, remaining time and buffer) are now drawn equally thick and with pixel-perfect precision. The track thickness can be controlled with the new trackThickness property.
  • The intrinsic content size of all controls is now correct.
  • When entering picture in picture, the picture in picture button does not toggle erratically between states anymore.

Intrinsic content size fixes -

  • The intrinsic content size of overlay views has been fixed.

Maintenance release -

This version modernises the project with Xcode 9.3.

Image customization fixes -

  • Custom control images could previously be directly set in Interface Builder for properties marked with the IBInspectable attribute. Support for inspectable image properties (and more widely for user-defined image runtime attributes) was recently discovered to be buggy, though. When setting images through inspectable properties or user-defined runtime attributes, this problem can lead to incorrect image sizes, broken Interface Builder previews and constraint issues at runtime.

    Inspectable attributes have therefore been dropped for all SRG Media Player controls until this issue has been fixed by Apple. This includes SRGAirplayButton, SRGPictureInPictureButton, SRGPlaybackButton, SRGTracksButton and SRGViewModeButton.

    Existing applications which were setting image properties in code will continue to work, but should now set images in code for reliable behavior. We recommend you update your codebase as follows:

    • Open xibs or storyboards containing a control for which an image was set in Interface Builder (see above list).
    • Open the 3rd tab (identity inspector) of the utility panel (⌥⌘0) and look at image-related user-defined runtime attributes.
    • Set these image properties directly in your implementation file (you might need to bind a related outlet if you did not have one).
    • In Interface Builder, clear these user-defined runtime attributes.
  • The time slider class provided the valueString and timeLeftValueString properties, which were misleading and not really useful.

  • New methods have been added to the SRGTimeSliderDelegate protocol to let you fully customize how current and remaining times are displayed (as well as the underlying accessibility labels if needed):

  • On iOS 11, seeking to the end of a media does not leave the player in an inconsistent state anymore.

Segment transition fix -

  • When updating the list of segments attached to a controller, segment transitions are correctly inhibited in the case where a segment is replaced with an equivalent one.

Maintenance release -

  • The stream type is now correctly reported as SRGMediaPlayerStreamTypeUnknown when preparing to play a media (it was previously incorrectly reported as SRGMediaPlayerStreamTypeLive).
  • The 360° playback view is now correctly hidden when casting with AirPlay.
  • The 360° default icon has been updated.

360° video support -

Support for 360° video playback has been added. The SRGMediaPlayerView class now has an additional viewMode property, which lets you choose how a media should be rendered:

  • Flat: Normal playback.
  • Monoscopic: 360° full-frame video playback.
  • Stereoscopic: 360° split-frame video playback for use with headsets.

A new SRGViewModeButton overlay button has been added as well to automatically provide users with a quick way to switch between supported modes.

360° content navigation responds both to device motions as well as pan gestures. If your application currently uses no Core Motion tracker, SRG Media Player will silently instantiate one for you. If your application readily uses a Core Motion tracker, use the new -[SRGMediaPlayerView setMotionManager:] method to use it for 360° video navigation as well.