How to Display Video from URL inside custom design UIView

Related tags

Video video_from_url
Overview

Technicalisto

How to Display Video from URL inside custom design UIView

  1. Add your UIView and connect it .

  2. Add This method for display

    func DisplayVideoFromUrl(myUrl:String , myView:UIView) {

     let player = AVPlayer(url: URL(string: myUrl)!)
     
     let playerLayer = AVPlayerLayer(player: player)
     
     playerLayer.videoGravity = .resizeAspectFill //
     playerLayer.needsDisplayOnBoundsChange = true //
     playerLayer.frame = videoView.bounds // 1
    
     myView.layer.masksToBounds = true // 2
     myView.layer.addSublayer(playerLayer)
     
     player.play()
    

    }

  3. Call method by your video Url & UIView

    self.DisplayVideoFromUrl(myUrl: "http://techslides.com/demos/sample-videos/small.mp4", myView: videoView)

    // Note This Url is an Example ...

Thanks

You might also like...
A video composition framework build on top of AVFoundation. It's simple to use and easy to extend.
A video composition framework build on top of AVFoundation. It's simple to use and easy to extend.

A high-level video composition framework build on top of AVFoundation. It's simple to use and easy to extend. Use it and make life easier if you are implementing video composition feature.

Overlay alpha channel video animation player view using Metal.
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

โ–ถ๏ธ 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

Swifty360Player - iOS 360-degree video player streaming from an AVPlayer.
Swifty360Player - iOS 360-degree video player streaming from an AVPlayer.

Swifty360Player iOS 360-degree video player streaming from an AVPlayer. Demo Requirements Swifty360Player Version Minimum iOS Target Swift Version 0.2

 VGPlayer - ๐Ÿ“บ  A simple iOS video player by Vein.
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.

Repository with base samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Includes steps for encoding and packaging your own test content.

Video Everything Repository with minimal samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Content and License All t

Open Source iOS 360 Degree Panorama Video Player.
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

๐Ÿ“ฑiOS app to extract full-resolution video frames as images.
๐Ÿ“ฑiOS app to extract full-resolution video frames as images.

Frame Grabber is a focused, easy-to-use iOS app to extract full-resolution video frames as images. Perfect to capture and share your favorite video mo

High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.
High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.

High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.

Owner
Aya Baghdadi
Mid IOS Developer & Junior Flutter Developer
Aya Baghdadi
A set of tools to trim, crop and select frames inside a video

PryntTrimmerView A set of tools written in swift to crop and trim videos. Example To run the example project, clone the repo, and run pod install from

Henry Huck 742 Jan 5, 2023
๐Ÿ“น Framework to Play a Video in the Background of any UIView

SwiftVideoBackground is an easy to use Swift framework that provides the ability to play a video on any UIView. This provides a beautiful UI for login

Wilson Ding 333 Nov 23, 2022
A fully functional short video app project.Record a six secends video while playing prank sounds.

prankPro A fully functional short video app project How to Install 1. use coconapod to init your xcode environment. 2. change the app-keys in `applica

huijimuhe 258 Jun 19, 2022
JDVideoKit - You can easily transfer your video into Three common video type.

JDVideoKit Introduction You can easily transfer your video into Three common video type. You can use set up camera easily. Installation pod 'JDVideoK

้ƒญไป‹้จต 24 Sep 9, 2021
A Swift library to upload video files to api.video platform.

api.video IOS video uploader api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and manag

api.video 7 Dec 9, 2022
api.video is the video infrastructure for product builders

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

api.video 4 Jun 27, 2022
๐Ÿ“ฝ 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
ABMediaView can display images, videos, as well as now GIFs and Audio!

Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.

Andrew Boryk 80 Dec 20, 2022
This Google Cast demo app shows how to cast videos from an iOS device in a way that is fully compliant with the Cast Design Checklist.

CastVideos-ios (reference iOS sender app) This Google Cast demo app shows how to cast videos from an iOS device in a way that is fully compliant with

Google Cast 168 Jan 6, 2023
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