ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - abdullahselek/Swifty360Player: iOS 360-degree video player streaming from an AVPlayer.
iOS 360-degree video player streaming from an AVPlayer. - abdullahselek/Swifty360Player
Visit Site

GitHub - abdullahselek/Swifty360Player: iOS 360-degree video player streaming from an AVPlayer.

GitHub - abdullahselek/Swifty360Player: iOS 360-degree video player streaming from an AVPlayer.

Build Status CocoaPods Compatible Carthage Compatible License

Swifty360Player Swifty360Player

iOS 360-degree video player streaming from an AVPlayer.

Demo

Swifty360Player 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:

.package(url: "https://github.com/abdullahselek/Swifty360Player.git", from: "0.2.7")

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 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)

Tap Gesture Handler

@objc func reorientVerticalCameraAngle() {
    swifty360ViewController.reorientVerticalCameraAngleToHorizon(animated: true)
}

Using storyboard and Swifty360ViewController as parent class

guard let swifty360ViewController = self.storyboard?.instantiateViewController(withIdentifier: "TestViewController") as? TestViewController else {
    return
}
let videoURL = URL(fileURLWithPath: Bundle.main.path(forResource: "google-help-vr", ofType: "mp4")!)
let player = AVPlayer(url: videoURL)
let motionManager = Swifty360MotionManager.shared
swifty360ViewController.player = player
swifty360ViewController.motionManager = motionManager
self.present(swifty360ViewController, animated: true, completion: nil)
import UIKit
import Swifty360Player

class TestViewController: Swifty360ViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        player.play()
    }

}

Example use of Swifty360View with using code commands

let videoURL = URL(fileURLWithPath: Bundle.main.path(forResource: "google-help-vr", ofType: "mp4")!)
let player = AVPlayer(url: videoURL)

let motionManager = Swifty360MotionManager.shared

let swifty360View = Swifty360View(withFrame: view.bounds,
                                  player: player,
                                  motionManager: motionManager)
swifty360View.setup(player: player, motionManager: motionManager)
view.addSubview(swifty360View)

player.play()

Using Swifty360View with Storyboard

  • Add a UIView to your viewcontroller and change it's class as Swifty360View
  • Connect via IBOutlets

and

let videoURL = URL(fileURLWithPath: Bundle.main.path(forResource: "google-help-vr", ofType: "mp4")!)
let player = AVPlayer(url: videoURL)

let motionManager = Swifty360MotionManager.shared

swifty360View.setup(player: player, motionManager: motionManager)

player.play()

Tap gesture recognizers for Swifty360View, create one recognizer for your viewcontroller's view

let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(reorientVerticalCameraAngle))
view.addGestureRecognizer(tapGestureRecognizer)

and selector function

@objc func reorientVerticalCameraAngle() {
    swifty360View.reorientVerticalCameraAngleToHorizon(animated: true)
}

License

Swifty360Player is released under the MIT license. See LICENSE for details.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory