About
The SRG Media Player library provides a simple way to add universal audio / video playback support to any application. It provides:
- A controller with precise playback state information and and a simple but powerful playback API.
- Automatic integration with
AVPlayerViewController
. - A set of overlays which can be combined to create custom player user interfaces.
- Support for subdivision of medias in (non-overlapping) sequences, which can provide am additional finer-grained playback structure or block playback to parts of the content.
- Support for on-demand, live and DVR streams.
- Support for 360° and cardboard playback.
- Ability to use several instances of the player at the same time.
Compatibility
The library is suitable for applications running on iOS 9, tvOS 12 and above. The project is meant to be compiled with the latest Xcode version.
Contributing
If you want to contribute to the project, have a look at our contributing guide.
Integration
The library must be integrated using Swift Package Manager directly within Xcode. You can also declare the library as a dependency of another one directly in the associated Package.swift
manifest.
Usage
When you want to use classes or functions provided by the library in your code, you must import it from your source files first. In Objective-C:
@import SRGMediaPlayer;
or in Swift:
import SRGMediaPlayer
Working with the library
To learn about how the library can be used, have a look at the getting started guide.
Logging
The library internally uses the SRG Logger library for logging, within the ch.srgssr.mediaplayer
subsystem. This logger either automatically integrates with your own logger, or can be easily integrated with it. Refer to the SRG Logger documentation for more information.
Control preview in Interface Builder
Interface Builder can render custom controls dropped onto a storyboard or a xib. If you want to enable this feature for SRG Media Player controls, copy the SRGMediaPlayerDesignables.m
file available from the Swift Package Manager checkout to your project and add it to your target.
When dropping a media player control (e.g. SRGPictureInPictureButton
) onto a storyboard or xib, Xcode will now build your project in the background and render the view when it is done.
Remark
Since the SRGMediaPlayerDesignables.m
must be copied to your project, you should update this file when updating the SRG Media Player library.
Demo project
To test what the library is capable of, run the associated demo.
License
See the LICENSE file for more information.