All Projects → numen31337 → Akvideoimageview

numen31337 / Akvideoimageview

Licence: mit
UIImageView subclass that allows you to display a looped video and dynamically switch it.

Projects that are alternatives of or similar to Akvideoimageview

Abmediaview
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.
Stars: ✭ 79 (-35.77%)
Mutual labels:  avplayer, uiimageview
Tbplayer
视频边下边播播,把播放器播放过的数据流缓存到本地,支持拖动。采用avplayer
Stars: ✭ 1,334 (+984.55%)
Mutual labels:  avplayer
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (+708.94%)
Mutual labels:  loop
Youtubedirectlinkextractor
Get the direct link to a YouTube video for AVPlayer
Stars: ✭ 76 (-38.21%)
Mutual labels:  avplayer
React Native Ezplayer
EZPlayer component for react-native apps
Stars: ✭ 47 (-61.79%)
Mutual labels:  avplayer
Bentools Etl
PHP ETL (Extract / Transform / Load) library with SOLID principles + almost no dependency.
Stars: ✭ 45 (-63.41%)
Mutual labels:  loop
Aaviewanimator
AAViewAnimator is a set of animations designed for UIView, UIButton, UIImageView with options in iOS, written in Swift.
Stars: ✭ 33 (-73.17%)
Mutual labels:  uiimageview
Arplayer
Playback videos using ARKit and AVFoundation.
Stars: ✭ 117 (-4.88%)
Mutual labels:  avplayer
Ksplayer
iOS/macOS/tvOS video player
Stars: ✭ 86 (-30.08%)
Mutual labels:  avplayer
Distube
A Discord.js v12 module to simplify your music commands and play songs with audio filters on Discord without any API key. Support YouTube, SoundCloud, Bandcamp, Facebook, and 700+ more sites
Stars: ✭ 73 (-40.65%)
Mutual labels:  loop
Efimageviewzoom
DEPRECATED 🌃 A very simple IBDesignable UIImageView with pinch zoom swift
Stars: ✭ 71 (-42.28%)
Mutual labels:  uiimageview
Kjplayerdemo
视频播放壳子:动态切换内核,支持边下边播边缓存的播放器方案,视频支持格式:mp4、m3u8、wav、avi,音频支持格式:midi、mp3
Stars: ✭ 60 (-51.22%)
Mutual labels:  avplayer
Infinite Uicollectionview
Make a UICollectionView infinitely scrolling by looping through content
Stars: ✭ 82 (-33.33%)
Mutual labels:  loop
Ios Lame Audio Transcoding
AVAudioRecorder
Stars: ✭ 105 (-14.63%)
Mutual labels:  avplayer
Summerslider
🍭 SummerSlider that can distinguish the parts where the advertisement of the video player comes out
Stars: ✭ 61 (-50.41%)
Mutual labels:  avplayer
Mcplayerkit
MCPlayerKit is iOS Player, PlayerCoreType: AVPlayer can use play some video, IJKPlayer type can play video, Live ...
Stars: ✭ 34 (-72.36%)
Mutual labels:  avplayer
Audioplayermanager
⚠️ No longer maintained ⚠️ Small Swift Wrapper and Queue-Manager around AVPlayer which let you play MediaPlayer items and stream songs from URLs.
Stars: ✭ 78 (-36.59%)
Mutual labels:  avplayer
Swifty360player
iOS 360-degree video player streaming from an AVPlayer.
Stars: ✭ 118 (-4.07%)
Mutual labels:  avplayer
Dynamicclipimage
iOS实现动态区域裁剪图片
Stars: ✭ 110 (-10.57%)
Mutual labels:  uiimageview
Service
Service encapsulates an object which executes a bit of code in a loop that can be started or stopped and query whether it is running or not.
Stars: ✭ 86 (-30.08%)
Mutual labels:  loop

AKVideoImageView

Platform CocoaPods

Motivation

AKVideoImageView was created because I wasn't satisfied with the standard AVPlayer when I was implementing a video background for one of my apps. The main issue is that AVPlayer doesn't let the phone go to sleep mode. Additionally, you can't insensibly start the video from the first frame when the app enters the background. This class solves these problems and has a less noticeable lag when switching from the last to the first frame of the video.

AKVideoImageView Example

Features

  • Allows the phone to go to the sleep mode
  • Ability to dynamically switch videos
  • Automatically switches to the first frame of video to have a seamless transition when the app returns from the background
  • Minimal memory footprint
  • Good performance
  • Ability to use mp4 files as the video source
  • Interface Builder support

Usage

Compressing your video file

Before starting using this class, you need to properly compress the video.
Here is an example of libx264 compression options on OS X system using FFmpeg utility:

ffmpeg -i input.mov -vcodec libx264 -level 3.1 -pix_fmt yuv420p -threads 1 -preset placebo -crf 19 -tune film -x264opts colorprim=bt709:transfer=bt709:colormatrix=bt709:fullrange=off output.mp4

Using Interface Builder

Just drag the UIImageView to your UIView and set its class to the AKVideoImageView. In the Attributes Inspector set the Video File Name to the name of your .mp4 video file without extension. See an example project for more info if needed.

Using Code

Objective-C:

#import "AKVideoImageView.h"

NSURL *videoURL = [[NSBundle mainBundle] URLForResource:@"videoName" withExtension:@"mp4"];
AKVideoImageView *videoBG = [[AKVideoImageView alloc] initWithFrame:self.view.bounds
                                                           videoURL:videoURL];
[self.view addSubview:videoBG];
[self.view sendSubviewToBack:videoBG];

Swift:

import AKVideoImageView

let url = Bundle.main.url(forResource: "video_1", withExtension: "mp4")!
let videoView = AKVideoImageView(frame: view.bounds, videoURL: url)!
view.addSubview(videoView)

Dynamically changing video

NSURL *videoURL = [[NSBundle mainBundle] URLForResource:@"anotherVideoName" withExtension:@"mp4"];
self.videoBG.videoURL = videoURL;

Installation

Manually

Just add AKVideoImageView.h and AKVideoImageView.m files to your project.

CocoaPods

Add the following line to your Podfile.

pod "AKVideoImageView", "~> 1.1"

Then run pod install.

License (MIT)

Copyright (c) 2017 Oleksandr Kirichenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].