360 video player for iOS written in swift - a subset of SceneKit that works

Overview

DDDKit

Swift Version Version License Platform

An open source library to support 360 videos and pictures. It's designed as a generic 3D library that you can use for much more!

Example of use cases

  • 360 video player
  • 360 image display
  • generic 3D scene
  • photo / video filters within a 3D scene

Installation

See the wiki! or:

pod 'DDDKit'

Quickstart

import DDDKit
import AVFoundation

class ViewController: DDD360VideoViewController {

  override func viewDidLoad() {
    super.viewDidLoad()
    show(from: myVideoURL)
  }
}

Example

Image filter (easy to be creative!)

// B&W filter:
@IBAction func didPressBW(_ sender: Any) {
  let program = try! DDDShaderProgram(fragment: defaultShader, shaderModifiers: [
    .fragment: "gl_FragColor = vec4(vec3(gl_FragColor.x + gl_FragColor.y + gl_FragColor.z) / 3.0, 1.0);",
  ])
  videoNode.material.shaderProgram = program
}

360 cubic projection

node.geometry = DDDGeometry.Cube()
let videoTexture = DDDVideoTexture(player: player) // AVPlayer with 360 cubic video
node.material.set(
  property: videoTexture,
  for: "SamplerY",
  and: "SamplerUV"
)

Screenshots from the demo app:

output output

Documentation

See the wiki!

Features

  • easy to use syntax and logic
  • support of image and video textures
  • direct and easy access to shader's code, shaders modifiers -> easy to make image filters
  • focus on reliability on video support.
  • equirectangular and cubic 360 support
  • elements that can have any shape / position

Why not SceneKit?

  • SceneKit has bugs, such as memory leaks, failing video support (see SO)
  • no support of AVPlayerLayer / AVPlayer as video input
  • indirect video support (through SpriteKit)
  • openGL backed rendering failing on iOS 10
  • poor documentation
  • unresponsiveness from Apple on issues, and no timeline/transparency on fixes
  • no access to code to fix things yourself, since it's not open source.

Author

Guillaume Sabran, [email protected], CTO @Pie

License

DDDKit is available under the MIT license. See the LICENSE file for more info.

Comments
  • Zoom?

    Zoom?

    Hi, I'm trying to replicate the projection used by the GoPro Kolor 360 player, which looks much more "zoomed in" than the default view in DDDKit. Both DDDKit and GoPro Kolor use equirectangular projections (at least if I am reading the comments in DDDSphere.swift and the Kolor release notes correctly. I've tried messing with the radius of the sphere but I don't see an obvious difference. Do you have any suggestions? Any help would be much appreciated. Thanks! Max

    opened by maxvonhippel 4
  • Pan gesture is laggy.

    Pan gesture is laggy.

    First of all, nice library!

    I found one small performance issue on didPan method. Video is moving smooth for 1 second and after that I see many lags. It's not smooth. I tested it on simulator and iPhone 6. Can you guys take a look into that problem?

    Thanks.

    opened by ghost 3
  • Installation Section

    Installation Section

    Hey, your library is really interesting.

    The only problem I found was the README.md, which lacks an Installation Section I created this iOS Open source Readme Template so you can take a look on how to easily create an Installation Section If you want, I can help you to organize the lib.

    What are your thoughts? 😄

    opened by lfarah 3
  • Custom shaders for SKVideoNode

    Custom shaders for SKVideoNode

    Hi,

    I'm planning on using SpriteKit for an app but I noticed they don't allow custom shaders / filters for the SKVideoNode class.

    Upon Googling I came across your custom library for SceneKit and noticed you have written your own video texture implementation. Does this allow you to apple custom GL shaders to videos and do you think it would be possible to port your video texture implementation to work with SpriteKit?

    Thanks!

    Alex

    opened by alexfoxy 1
  • Not able to rotate the video at 180 degree

    Not able to rotate the video at 180 degree

    Hi, i found this library very useful for me. The issue i am getting is i am not able to rotate the video at 180 degree in portrait mode actually the video is upside down type and i need to rotate the video. i have changed code for DDD360VideoViewController file in setUpPlayback() function which is ` private func setUpPlayback(for asset: AVAsset) { let requestedKeys = [kTracksKey, kPlayableKey] asset.loadValuesAsynchronously(forKeys: requestedKeys, completionHandler: { DispatchQueue.main.async { let status = asset.statusOfValue(forKey: self.kTracksKey, error: nil) if status == AVKeyValueStatus.loaded { self.playerItem = AVPlayerItem(asset: asset) self.player?.replaceCurrentItem(with: self.playerItem!) let playerLayer = AVPlayerLayer(player: self.player) playerLayer.frame = self.view.bounds //bounds of the view in which AVPlayer should be displayed playerLayer.videoGravity = .resizeAspectFill playerLayer.setAffineTransform(CGAffineTransform(rotationAngle: -3.15)) playerLayer.frame = self.view.bounds playerLayer.videoGravity = AVLayerVideoGravity.resizeAspect self.view.layer.addSublayer(playerLayer) self.player?.play() } }

        })
    }`
    

    I am attaching a screen shot of video i need to show the face from top side image Please help me out!

    Thanx, Prem

    opened by Dev-Prem 0
  • Crash in retrievePixelBufferToDraw() func in DDDVideoTexture.swift

    Crash in retrievePixelBufferToDraw() func in DDDVideoTexture.swift

    Hi, First of all your library is too good. i found an issue while running it on ipad mini and iphone 6 of version 12.4.1 and 12.4.4 and also in lesser version it produce crash there in retrievePixelBufferToDraw() func i didn't recognise why am i getting these crash every time. please help me out with these. line no. 195 in DDDVideoTexture.swift.

    Thanx, Akhil

    opened by RanjanMyGitHub 1
Owner
Guillaume Sabran
Guillaume Sabran
Open Source iOS 360 Degree Panorama Video Player.

?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? The Metal with Swift 5.0 version is comming ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 360 VR Player A Open Source, Ad-free, Na

Hanton Yang 2k Dec 24, 2022
NYT360Video plays 360-degree video streamed from an AVPlayer on iOS.

NYT360Video 360º video playback from The New York Times NYT360Video plays spherical 360º video, allowing the user to explore the video via pan gesture

The New York Times 270 Nov 23, 2022
NYT360Video plays 360-degree video streamed from an AVPlayer on iOS.

NYT360Video 360º video playback from The New York Times NYT360Video plays spherical 360º video, allowing the user to explore the video via pan gesture

The New York Times 270 Nov 23, 2022
Musical Player - A Simple Musical Player For iOS

Musical_Player The app is a musical player. It was written as an task for a mobi

null 1 Nov 26, 2022
▶️ video player in Swift, simple way to play and stream media on iOS/tvOS

Player Player is a simple iOS video player library written in Swift. Looking for an obj-c video player? Check out PBJVideoPlayer (obj-c). Looking for

patrick piemonte 2k Jan 2, 2023
FWVideoPlayer is video Player for iOS in Swift.

FWVideoPlayer Desc FWVideoPlayer is video Player for iOS in Swift. It can play video and audio. You can use it easy. Example To run the example projec

null 1 Oct 15, 2021
BMPlayer - A video player for iOS, based on AVPlayer, support the horizontal, vertical screen

A video player for iOS, based on AVPlayer, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles.

Eliyar Eziz 1.8k Jan 4, 2023
VGPlayer - 📺 A simple iOS video player by Vein.

Swift developed based on AVPlayer iOS player,support horizontal gestures Fast forward, pause, vertical gestures Support brightness and volume adjustment, support full screen, adaptive screen rotation direction.

Wen Rong 399 Dec 23, 2022
iOS video player for trailer. You can customize layout for the control panel. Support PiP and DRM.

iOS video player for trailer. You can customize layout for the control panel. Support PiP and DRM.

Abe Wang 11 Nov 7, 2022
Yattee: video player for Invidious and Piped built for iOS 15, tvOS 15 and macOS Monterey

Video player with support for Invidious and Piped instances built for iOS 15, tvOS 15 and macOS Monterey.

Yattee 1k Dec 27, 2022
YouTube video player for iOS, tvOS and macOS

About XCDYouTubeKit is a YouTube video player for iOS, tvOS and macOS. Are you enjoying XCDYouTubeKit? You can say thank you with a tweet. I am also a

Cédric Luthi 2.9k Jan 7, 2023
Versatile Video Player implementation for iOS, macOS, and tvOS

News ?? - Since 2.1.3 VersaPlayer now supports iOS, macOS, and tvOS Example Installation Usage Basic Usage Adding Controls Advanced Usage Encrypted Co

Jose Quintero 723 Dec 26, 2022
Yattee: video player for Invidious and Piped built for iOS, tvOS and macOS

Video player for Invidious and Piped instances built for iOS, tvOS and macOS. Features Native user interface built with SwiftUI Multiple instances and

Yattee 1.1k Jan 8, 2023
YHPlayer - An easy-to-use video player based on swift language

YHPlayer An easy-to-use video player based on swift language Features Plays loca

null 9 Dec 1, 2022
Overlay alpha channel video animation player view using Metal.

Overlay alpha channel video animation player view using Metal. Example To run the example project, clone the repo, and run pod install from the Exampl

noppefoxwolf 244 Jan 1, 2023
📽 A video player for SwiftUI, support for caching, preload and custom control view.

Features QuickStart Advances Installation Requirements License Demo Clone or download the project. In the terminal, run swift package resolve. Open Vi

Gesen 437 Jan 5, 2023
SuperVideoPlayer is video player in Objc.

SuperVideoPlayer Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation S

null 1 Oct 19, 2021
IINA is the modern video player for macOS.

IINA IINA is the modern video player for macOS. Website · Releases · Telegram Group Features Based on mpv, which provides the best decoding capacity o

Jesse Chan 0 Nov 2, 2021
YoutubeKit is a video player that fully supports Youtube IFrame API and YoutubeDataAPI for easily create a Youtube app

YoutubeKit YoutubeKit is a video player that fully supports Youtube IFrame API and YoutubeDataAPI to easily create Youtube applications. Important Ref

Ryo Ishikawa 555 Dec 28, 2022