iOS 360-degree video player streaming from an AVPlayer.
Demo
Requirements
Swifty360Player Version
Minimum iOS Target
Swift Version
0.2.7
11.0
5.x
0.2.2
11.0
4.2
0.2.1
10.0
4.1
0.2
10.0
4.0
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate Swifty360Player into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Swifty360Player', '0.2.7'
end
Then, run the following command:
$ pod install
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
brew update
brew install carthage
To integrate Swifty360Player into your Xcode project using Carthage, specify it in your Cartfile:
github "abdullahselek/Swifty360Player" ~> 0.2.7
Run carthage update to build the framework and drag the built Swifty360Player.framework into your Xcode project.
Swift Package Manager
Modify your Package.swift file to include the following dependency:
XCFrameworks require Xcode 11 or later and integration is very similar to integration of .framework format. Please use script scripts/build-framework.sh to generate binary Swifty360Player.xcframework archive that you can use as a dependency in Xcode.
Swifty360Player.xcframework is a Release (Optimized) binary that offer best available Swift code performance.
Example Usage
You just need an AVPlayer instance created with a valid video url and a Swifty360MotionManager instance. You can use these code snippets in a UIViewController instance.
Video url can be either local or remote.
let videoURL = URL(fileURLWithPath: Bundle.main.path(forResource: "google-help-vr", ofType: "mp4")!)
let player = AVPlayer(url: videoURL)
let motionManager = Swifty360MotionManager.shared
swifty360ViewController = Swifty360ViewController(withAVPlayer: player, motionManager: motionManager)
addChildViewController(swifty360ViewController)
view.addSubview(swifty360ViewController.view)
swifty360ViewController.didMove(toParentViewController: self)
player.play()
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(reorientVerticalCameraAngle))
view.addGestureRecognizer(tapGestureRecognizer)
iOS 360-degree video player streaming from an AVPlayer.
Demo
Requirements
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
To integrate Swifty360Player into your Xcode project using CocoaPods, specify it in your Podfile:
Then, run the following command:
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
To integrate Swifty360Player into your Xcode project using Carthage, specify it in your Cartfile:
Run carthage update to build the framework and drag the built Swifty360Player.framework into your Xcode project.
Swift Package Manager
Modify your Package.swift file to include the following dependency:
Run
swift package resolve
XCFramework
XCFrameworks require Xcode 11 or later and integration is very similar to integration of .framework format. Please use script scripts/build-framework.sh to generate binary Swifty360Player.xcframework archive that you can use as a dependency in Xcode.
Swifty360Player.xcframework is a Release (Optimized) binary that offer best available Swift code performance.
Example Usage
You just need an
AVPlayer
instance created with a valid video url and aSwifty360MotionManager
instance. You can use these code snippets in aUIViewController
instance.Video url can be either local or remote.
Tap Gesture Handler
Using storyboard and
Swifty360ViewController
as parent classExample use of
Swifty360View
with using code commandsUsing
Swifty360View
with StoryboardUIView
to your viewcontroller and change it’s class asSwifty360View
and
Tap gesture recognizers for
Swifty360View
, create one recognizer for your viewcontroller’s viewand selector function
License
Swifty360Player is released under the MIT license. See LICENSE for details.