Skip to content

Commit

Permalink
Merge pull request #19 from StreamAMG/release/1.2.3
Browse files Browse the repository at this point in the history
SMD-2228 Release iOS SDK
  • Loading branch information
StefanoStream authored Jun 5, 2023
2 parents cfe4b3c + 56f9d3a commit f939fbd
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Change Log:

All notable changes to this project will be documented in this section.

### 1.2.3
- Improved bitrate/subtitle icon logic
- Added custom minimise icon

### 1.2.2
- Improved bitrate selector

Expand Down
5 changes: 5 additions & 0 deletions PlayKitReadme.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ Specify the image to use for the fullscreen button
.fullScreenImage(_ image: String)
```

Specify the image to use for the minimise button
``` Swift
.minimiseImage(_ image: String)
```

Hide the 'fullscreen' button when the player is not in full screen
``` Swift
.hideFullScreenButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ class AMGPlayKitStandardControl: UIView, AMGControlDelegate {
settingsButton.setImage(settingsImage, for: .normal)
settingsButton.addTarget(self, action: #selector(openBitrateView), for: .touchUpInside)
settingsButton.layer.cornerRadius = 8
settingsButton.isHidden = true
mainView.addSubview(settingsButton)
}

Expand All @@ -393,6 +394,7 @@ class AMGPlayKitStandardControl: UIView, AMGControlDelegate {
subtitlesButton.setImage(subtitlesImage, for: .normal)
subtitlesButton.addTarget(self, action: #selector(openSubtitlesView), for: .touchUpInside)
subtitlesButton.layer.cornerRadius = 8
subtitlesButton.isHidden = true
mainView.addSubview(subtitlesButton)
}

Expand All @@ -402,7 +404,6 @@ class AMGPlayKitStandardControl: UIView, AMGControlDelegate {


}


func updateIsLive(){
DispatchQueue.main.async { [self] in
Expand Down Expand Up @@ -661,7 +662,7 @@ class AMGPlayKitStandardControl: UIView, AMGControlDelegate {

// If bitrate selector is visible , then display subtitles button next to bitrate selector ,
// else move subtitles button to end of frame
if configModel.bitrateSelector {
if configModel.bitrateSelector && !settingsButton.isHidden {
subtitlesButton.frame = CGRect(x: settingsButton.frame.origin.x - subtitlesButton.frame.width, y: h - skipSize - 5, width: skipSize, height: skipSize)
} else {
subtitlesButton.frame = CGRect(x: w - skipSize - 20, y: h - skipSize - 5, width: skipSize, height: skipSize)
Expand Down Expand Up @@ -700,6 +701,15 @@ class AMGPlayKitStandardControl: UIView, AMGControlDelegate {
var count = 0
DispatchQueue.main.async { [self] in
self.subtitlesScroll.removeFromSuperview()

if withTracks.isEmpty {
subtitlesButton.isHidden = true
return
} else {
subtitlesButton.isHidden = false
}
resize()

self.subtitlesScroll = self.createContentScroll(scrollViewWidth: maxWidth, itemCount: self.tracks.count)

self.tracks.forEach { track in
Expand Down Expand Up @@ -730,8 +740,15 @@ class AMGPlayKitStandardControl: UIView, AMGControlDelegate {
var count = 1
DispatchQueue.main.async { [self] in
self.bitrateScroll.removeFromSuperview()
self.bitrateScroll = createContentScroll(scrollViewWidth: maxWidth, itemCount: self.bitrates.count + 1)

if withBitrateList.isEmpty {
settingsButton.isHidden = true
return
} else {
settingsButton.isHidden = false
}

self.bitrateScroll = createContentScroll(scrollViewWidth: maxWidth, itemCount: self.bitrates.count + 1)

let button = createButtonLabel(text: "Auto", width: maxWidth, index: 0, selectedIndex: self.selectedBitrate, colors: selectorColors)
button.addTarget(self, action: #selector(swapBitRate(button:)), for: .touchUpInside)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ public class AMGControlBuilder {
return self
}

/**
Specify the image to use for the minimise button
*/
public func minimiseImage(_ image: String) -> AMGControlBuilder {
self.minimiseImage = image
return self
}

/**
Specify the image to use for the skip forwards button
*/
Expand Down Expand Up @@ -294,7 +302,7 @@ public class AMGControlBuilder {
Returns a complete and valid AMGPlayKitStandardControlsConfigurationModel
*/
public func build() -> AMGPlayKitStandardControlsConfigurationModel {
return AMGPlayKitStandardControlsConfigurationModel(fadeInTogglesPausePlay: fadeInTogglesPausePlay, fadeInTime: fadeInTime, fadeOutTime: fadeOutTime, fadeOutAfter: fadeOutAfter, trackTimeShowing: trackTimeShowing, isLiveImage: isLiveImage, logoImage: logoImage, playImage: playImage, pauseImage: pauseImage, skipForwardImage: skipForwardImage, skipBackwardImage: skipBackwardImage, fullScreenImage: fullScreenImage, hideFullscreen: hideFullscreen, hideMinimise: hideMinimise, liveTrack: liveTrack, vodTrack: vodTrack, bitrateSelector: bitrateSelector, subTitlesSelector: subTitlesSelector)
return AMGPlayKitStandardControlsConfigurationModel(fadeInTogglesPausePlay: fadeInTogglesPausePlay, fadeInTime: fadeInTime, fadeOutTime: fadeOutTime, fadeOutAfter: fadeOutAfter, trackTimeShowing: trackTimeShowing, isLiveImage: isLiveImage, logoImage: logoImage, playImage: playImage, pauseImage: pauseImage, skipForwardImage: skipForwardImage, skipBackwardImage: skipBackwardImage, fullScreenImage: fullScreenImage, minimiseImage: minimiseImage, hideFullscreen: hideFullscreen, hideMinimise: hideMinimise, liveTrack: liveTrack, vodTrack: vodTrack, bitrateSelector: bitrateSelector, subTitlesSelector: subTitlesSelector)



Expand Down
2 changes: 2 additions & 0 deletions Source/StreamSDKPlayKit/Player/PlayKit/AMGPlayKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ import AVKit
if let textTracks = event.tracks?.textTracks {
self?.checkDefaultCaptionTrack(textTracks: textTracks)
self?.controlUI?.createSubtitlesSelector(withTracks: textTracks)
} else {
self?.controlUI?.createSubtitlesSelector(withTracks: [])
}
if let tracksExist = self?.tracks {
self?.listener?.tracksAvailable(tracks: tracksExist)
Expand Down
2 changes: 1 addition & 1 deletion StreamAMGSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Pod::Spec.new do |spec|

spec.name = "StreamAMGSDK"
spec.version = "1.2.2"
spec.version = "1.2.3"
spec.summary = "Stream AMG SDK"
spec.swift_versions = "5"

Expand Down

0 comments on commit f939fbd

Please sign in to comment.