Skip to content

Commit 1e4ada5

Browse files
committed
update with production SPM packages and better video example
1 parent b142699 commit 1e4ada5

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Get to know Mux by looking through examples! Contributions are always welcome, e
1414
| [now-airtable](now-airtable) | [Zeit Now](https://zeit.co/now) + [Airtable](https://airtable.com/). Build your own personal Video CMS using Now, [Next.js](https://nextjs.org/), and your own Airtable base. | VOD, CMS | JavaScript |
1515
| [signed-playback-lambda](signed-playback-lambda) | AWS Lambda that allows you to generate signed Mux playback URLs. | VOD, Serverless | JavaScript |
1616
| [gatsy-example-graphql](gatsby-example-graphql) | Gatsby project that uses Mux's OneGraph-powered GraphQL API | JAMstack, VOD, GraphQL | JavaScript |
17+
| [swift-video-app](swift-video-app) | Swift app that uses Mux Video, Mux Data and plays audio when the app goes into the background | VOD, Mobile | Swift |
1718

1819
## Examples in the wild
1920

swift-video-app/MuxExampleVideoApp/MuxExampleVideoApp.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
FA8188F7261E2C2D00FBF62B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA8188F5261E2C2D00FBF62B /* LaunchScreen.storyboard */; };
1616
FA818902261E2C2D00FBF62B /* MuxExampleVideoAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA818901261E2C2D00FBF62B /* MuxExampleVideoAppTests.swift */; };
1717
FA81890D261E2C2D00FBF62B /* MuxExampleVideoAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA81890C261E2C2D00FBF62B /* MuxExampleVideoAppUITests.swift */; };
18-
FAED236C261E3EE400474A86 /* MUXSDKStats in Frameworks */ = {isa = PBXBuildFile; productRef = FAED236B261E3EE400474A86 /* MUXSDKStats */; };
18+
FAC5AC5E263889170052F8A3 /* MUXSDKStats in Frameworks */ = {isa = PBXBuildFile; productRef = FAC5AC5D263889170052F8A3 /* MUXSDKStats */; };
1919
/* End PBXBuildFile section */
2020

2121
/* Begin PBXContainerItemProxy section */
@@ -57,7 +57,7 @@
5757
isa = PBXFrameworksBuildPhase;
5858
buildActionMask = 2147483647;
5959
files = (
60-
FAED236C261E3EE400474A86 /* MUXSDKStats in Frameworks */,
60+
FAC5AC5E263889170052F8A3 /* MUXSDKStats in Frameworks */,
6161
);
6262
runOnlyForDeploymentPostprocessing = 0;
6363
};
@@ -147,7 +147,7 @@
147147
);
148148
name = MuxExampleVideoApp;
149149
packageProductDependencies = (
150-
FAED236B261E3EE400474A86 /* MUXSDKStats */,
150+
FAC5AC5D263889170052F8A3 /* MUXSDKStats */,
151151
);
152152
productName = MuxExampleVideoApp;
153153
productReference = FA8188E7261E2C2A00FBF62B /* MuxExampleVideoApp.app */;
@@ -221,7 +221,7 @@
221221
);
222222
mainGroup = FA8188DE261E2C2A00FBF62B;
223223
packageReferences = (
224-
FAED236A261E3EE300474A86 /* XCRemoteSwiftPackageReference "mux-stats-sdk-avplayer" */,
224+
FAC5AC5C263889170052F8A3 /* XCRemoteSwiftPackageReference "mux-stats-sdk-avplayer" */,
225225
);
226226
productRefGroup = FA8188E8261E2C2A00FBF62B /* Products */;
227227
projectDirPath = "";
@@ -603,20 +603,20 @@
603603
/* End XCConfigurationList section */
604604

605605
/* Begin XCRemoteSwiftPackageReference section */
606-
FAED236A261E3EE300474A86 /* XCRemoteSwiftPackageReference "mux-stats-sdk-avplayer" */ = {
606+
FAC5AC5C263889170052F8A3 /* XCRemoteSwiftPackageReference "mux-stats-sdk-avplayer" */ = {
607607
isa = XCRemoteSwiftPackageReference;
608608
repositoryURL = "https://github.com/muxinc/mux-stats-sdk-avplayer.git";
609609
requirement = {
610610
kind = upToNextMajorVersion;
611-
minimumVersion = 2.2.0;
611+
minimumVersion = 2.2.1;
612612
};
613613
};
614614
/* End XCRemoteSwiftPackageReference section */
615615

616616
/* Begin XCSwiftPackageProductDependency section */
617-
FAED236B261E3EE400474A86 /* MUXSDKStats */ = {
617+
FAC5AC5D263889170052F8A3 /* MUXSDKStats */ = {
618618
isa = XCSwiftPackageProductDependency;
619-
package = FAED236A261E3EE300474A86 /* XCRemoteSwiftPackageReference "mux-stats-sdk-avplayer" */;
619+
package = FAC5AC5C263889170052F8A3 /* XCRemoteSwiftPackageReference "mux-stats-sdk-avplayer" */;
620620
productName = MUXSDKStats;
621621
};
622622
/* End XCSwiftPackageProductDependency section */

swift-video-app/MuxExampleVideoApp/MuxExampleVideoApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swift-video-app/MuxExampleVideoApp/MuxExampleVideoApp/SceneDelegate.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
5757
// a reference to it so we can re-attach it later
5858
if (videoViewController != nil) {
5959
avPlayerSavedReference = videoViewController!.player
60-
if (avPlayerSavedReference != nil) {
61-
avPlayerSavedReference?.currentItem?.preferredPeakBitRate = 300000
62-
}
6360
videoViewController?.player = nil
6461
}
6562
// Called as the scene transitions from the foreground to the background.

swift-video-app/MuxExampleVideoApp/MuxExampleVideoApp/ViewController.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ViewController: AVPlayerViewController {
1414
override func viewDidLoad() {
1515
super.viewDidLoad()
1616

17-
let url = URL(string: "https://stream.mux.com/qxb01i6T202018GFS02vp9RIe01icTcDCjVzQpmaB00CUisJ4.m3u8?add_audio_only=true")
17+
let url = URL(string: "https://stream.new/v/qxb01i6T202018GFS02vp9RIe01icTcDCjVzQpmaB00CUisJ4.m3u8")
1818
player = AVPlayer(url: url!)
1919
let playName = "iOS AVPlayer"
2020
let playerData = MUXSDKCustomerPlayerData(environmentKey: "ENV_KEY")
@@ -37,11 +37,8 @@ class ViewController: AVPlayerViewController {
3737

3838
let scene = UIApplication.shared.connectedScenes.first
3939
if let sceneDelegate : SceneDelegate = (scene?.delegate as? SceneDelegate) {
40-
print("debug found our SceneDelegate")
4140
sceneDelegate.videoViewController = self;
4241
}
4342
}
44-
45-
4643
}
4744

swift-video-app/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# swift-video-app
2+
3+
This is a swift app that uses AVPlayer, AVPlayerViewController and MuxData. The video source is a Mux Video HLS manifest, but that can be swapped out for any AVPlayer compatible source.
4+
5+
The main thing to test here was to get the audio to continue playing when the application enters the background. We wrote about it on [the Mux blog](mux.com/blog/background-audio-handling-with-ios-avplayer).

0 commit comments

Comments
 (0)