GithubHelp home page GithubHelp logo

josejuanqm / versaplayer Goto Github PK

View Code? Open in Web Editor NEW
779.0 779.0 120.0 5.37 MB

Versatile Video Player implementation for iOS, macOS, and tvOS

License: MIT License

Swift 98.67% Ruby 1.33%
ads airplay avplayer avplayeritem extensible extensions google ios picture-in-picture pip swift swift4 video video-player video-player-library

versaplayer's People

Contributors

akisute avatar danibachar avatar eke avatar ezimetjan avatar huseyinvural avatar jose-quintero avatar josejuanqm avatar pbeast avatar rajchanchal avatar selvinn avatar srinivasprabhug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

versaplayer's Issues

Controls on tvOS without focus

Maybe i didn't understand well how to use the controls for the player. I have added some Buttons to the View, connected them to the Controls-Class. If i tap the touchfield on the AppleTV-Remote, the controls appears, but got no focus so you can't select or click a Button.

Gesture not working

I add my gesture in viewDidLoad(), but it does not work till tapping to make osd on

let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(handleGesture))
swipeRight.direction = .right
self.view.addGestureRecognizer(swipeRight)

TV test app crashes on launch in tvOS 13

The sample TV app crashes on launch, with an error that seems nib related:

VersaPlayerTest_tvOS[69831:7967219] [Storyboard] Unknown class
_TtC20VersaPlayerTest_tvOS19VersaPlayerControls in Interface Builder
file.

Crashes sometimes

App crashes sometimes, attached is the screenshot from stack trace.
Any help?
Screen Shot 2019-11-26 at 9 19 19 AM

Strong type delegate

Hey, VersaPlayerPlaybackDelegate is a strong type delegate thus preventing deinit of a ViewController from being called due to strong reference. Protocol should be class type and delegate should be weak. Can you please fix this issue at the earliest.

Thanks in advance.

Not scrolling if put in scrollview after VideoPlayerControls disappears

If I put VersaPlayer in scrollview, and if VideoPlayerControls view disappears, the scrolling doesn't work if the drag gesture starts from player's view. It does work if the dragging finger doesn't start from player but some other components of the scrollview.

It does also work, if the controls are visible, as soon as they disappear, the scrolling no more works.

Unexpectedly found nil

handler.playbackDelegate?.playbackReady(player: self)

sometimes it gives me this crash.
my apps first screen has one player, second screen has another player. when i push second and fast pop back, it gives me this crash.
image

IB Designables: Failed to render and update auto layout status for VersaPlayerControls (wWX-7i-SUK): Failed to launch designables agent. Check the console for a more detailed description and please file a bug report at feedbackassistant.apple.com.

Xcode version: 11 Beta 2~4

There's a build error in red for the Full Screen Controls set stating: "IB Designables: Failed to render and update auto layout status for VersaPlayerControls (wWX-7i-SUK): Failed to launch designables agent. Check the console for a more detailed description and please file a bug report at feedbackassistant.apple.com."

The Full Screen Controls set were directly copied from the Example project file.

Mute/Unmute?

How to mute/unmute player? Is there any control there for it?

Languages

I Did not see language control? Is there one in the player?

Can not toggle the fullscreen and how to replay?

Describe the bug
After I press the fullscreen button I can't toggle it back to normal screen.

To Reproduce
image
When i toggle the fullscreen button, it gives the message as in the image .

Another question is when it finished how to replay it through press some button?

und nil while implicitly unwrapping an Optional value 2019-06-11 10:23:33.022373+0200 Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

hello
i try to launch a simple example
but playerView is null
my activity extend UIViewController ( built programmatically without storyboard )
i have the following error : Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
2019-06-11 10:23:33.022373+0200xxxxx[6256:1699778] Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

Video Controls not showing

Hi everyone, @josejuanqm

why video control not showing just video playing and no play or pause or seek bar ?

this is my code its same as example:

import UIKit
import VersaPlayer

class ViewController: UIViewController {

    @IBOutlet weak var playerView: VersaPlayerView!
    @IBOutlet weak var controls: VersaPlayerControls!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        if let url = URL.init(string:  "https://www.w3schools.com/html/movie.mp4") {
            let item = VersaPlayerItem(url: url)
            playerView.set(item: item)
        }
        
        playerView.layer.backgroundColor = UIColor.black.cgColor
        playerView.use(controls: controls)
    }

}

do i miss something ? show i enable or do more to show video controls ?

Fullscreen from tableview cell

Hi,

I was playing around with your library by implementing a VersaPlayerView embedded inside a UITableViewCell. Just wondering if you are able to point me in the right direction on how I can have a background behind the video when I have expanded it so I can block out the view behind it?

Thanks

Normal view

Screen Shot 2019-09-10 at 9 35 00 am
Screen Shot 2019-09-10 at 9 35 36 am

Expanded View

Screen Shot 2019-09-10 at 9 35 11 am
Screen Shot 2019-09-10 at 9 35 49 am

Xcode Theme

Do mine sharing the theme for Xcode?

Regarding the framework: nice work! Definitely going to give it a try in my project.

Thanks

App crash while setting PlayerItem to Player.

First of thanks for the excellent library.

When I try to install it via pod it install with "1.2.0" and VersaPlayerItem becomes to VPlayerItem and when I see both files then there's only 1 line of code public var isEncrypted: Bool = false

when I use below code then it crash at player.set(item: item) line of code with below bad access error.

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

override func viewDidLoad() {
        super.viewDidLoad()
        
        player.use(controls: controls)
        if let url = URL.init(string: "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8") {
            let item = VPlayerItem(url: url)
            player.set(item: item)
        }
    }

do I miss something or is there any issue with version?

It does not work with a local file.

I tried to play a local file but it does not work. Does the library support?

       let main = Bundle.main.path(forResource: "example", ofType: "mp4")!
        let url = URL(fileURLWithPath: main) 
        playerView.layer.backgroundColor = UIColor.black.cgColor
        playerView.use(controls: controls)
  
        let asset = AVURLAsset(url: url)
        let item = VersaPlayerItem(asset: asset)
        playerView.set(item: item)

Is it possible to set more height for player controls than the player view?

Is it possible to set more height for player controls than the player view? I have attached a screenshot where you can see the player view is that black background colored part above pink one and above there is controls setup with more height that extends till pink color starting from player view top. The problem is with the setup is touch isn't repond on that pink part but responds on playerview part

Screenshot 2020-03-02 at 3 33 26 PM

**Desktop **

  • iOS

is there any way to open the video in fullscreen on landscape mode?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Caching

Is there any caching mechanism for VersaPlay?

If so would like some tips on how to utilize it as it seems videos are always loaded no matter what.

Thanks!!

Can't initialize player, please help

Hello! When I try to initialize the player in the vc, the app crashes with this error

Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
on playerView.layer.backgroundColor = UIColor.black.cgColor

I am doing exactly everything as the example code, I literally copied it.Also tried to clone the repo and run the example player, which works, but when I create a view controller in my app, and navigate to it the app still crashes...

Current code im using:
`import UIKit
import VersaPlayer

class ViewController: UIViewController {

@IBOutlet weak var playerView: VersaPlayerView!
@IBOutlet weak var controls: VersaPlayerControls!

@IBAction func trigger(_ sender: UIButton) {
    print("test")
}

override func viewDidLoad() {
    super.viewDidLoad()
    
    playerView.layer.backgroundColor = UIColor.black.cgColor
    playerView.use(controls: controls)
    
    if let url = URL.init(string: "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8") {
        let item = VersaPlayerItem(url: url)
        playerView.set(item: item)
    }
}

}`

Also tried version 2.2.3 of the player, and with swift 4 and 4.2, still no luck..

Any idea what could it be?

Unable to play local file

Does this support playing a file from file system?

My file URL: file:///Users/gerald/Library/Developer/CoreSimulator/Devices/28694CEC-DEE0-4E95-9302-F3962DDC63B6/data/Containers/Data/Application/620DDA30-4A41-484D-AED5-9FB334C1E9F2/Library/Caches/MyApp/28.mp4

I've tried ...
if let url = URL.init(string: movieFile.filename) { let asset = AVURLAsset(url: url) let item = VersaPlayerItem(asset: asset) playerView.set(item: item) }

and

let url = URL.init(fileURLWithPath: movieFile.filename) print("FILE URL: \(url)") let item = VersaPlayerItem(url: url) playerView.set(item: item)

Both return PlaybackDidFailed Error - Unknown
Am I doing something wrong?

Local video support

Does it support to play a video from Bundle path?
If yes, then please help me to achieve that.

Controls dissapear

If the screen is tapped, while the video is buffering the controls dissapear normally. But tapping again the controls do not appear and the video does not load. Almost as if the app has frozen

add faster speed playback

Hi developer
do you have any plan to add faster speed playback option?
like 1.0x(original speed), 1.2x,1.5x, etc. speed to playback m3u8 videos

Landscape rotate

My app is restricted to portrait, but I would like enable rotation to landscape when in full screen mode. I have not been able to find if an override is provided here. Does VersaPlayer address this sort of thing? Great framework btw..

VersaPlayerPlaybackDelegate class type

Hey, please make VersaPlayerPlaybackDelegate of class type to avoid strong referencing. To change this please replace VersaPlayerPlaybackDelegate: AnyObject with VersaPlayerPlaybackDelegate: class

PFA fix screenshot.

screen shot 2019-01-08 at 1 31 02 pm

Thanks

Terminating app due to uncaught exception 'NSInternalInconsistencyException' only on iOS 10.3.3

Tested with a provided example by running Target VersaPlayerTest_iOS

Steps to produce the crash:
Step 1. Run project's target VersaPlayerTest_iOS on iOS 10.3.3 ( i used iPhone 6s)
Step 2. Tap on show video
Step 3. Tap on back button from the new view controller where the video is being played
and the app crashes!

Note: the app is working fine on my iOS 12.1 device

Crash Log:

1 <VersaPlayer.VersaPlayerView: 0x107e1b450; frame = (0 0; 375 667); autoresize = RM+BM; layer = <CALayer: 0x170227300>>
2 <VersaPlayer.VersaPlayerControlsCoordinator: 0x107d113b0; frame = (0 0; 375 667); layer = <CALayer: 0x174225aa0>>
3 <VersaPlayer.VersaPlayerGestureRecieverView: 0x107e31820; frame = (0 0; 375 667); gestureRecognizers = <NSArray: 0x170247680>; layer = <CALayer: 0x17022d240>>
4 <VersaPlayer.VersaPlayerControls: 0x107e06230; frame = (0 0; 375 667); autoresize = RM+BM; layer = <CALayer: 0x170226ca0>>
5 VersaPlayer.VersaPlayerControlsBehaviour
6 <VersaPlayer.VersaPlayerRenderingView: 0x107e07d30; frame = (0 0; 375 667); layer = <CALayer: 0x170229260>>
7 <VersaPlayer.VersaPlayerLayer: 0x170241ef0>
8 <VersaPlayer.VersaPlayerItem: 0x17022bde0, asset = <AVURLAsset: 0x17022bcc0, URL = https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8>>
9 <VersaPlayer.VersaPlayer: 0x1702419b0>
2019-04-02 00:38:57.968270+0530 VersaPlayerTest_iOS[16838:11201971] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x1702419b0 of class VersaPlayer.VersaPlayer was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x174220180> (
<NSKeyValueObservance 0x170242970: Observer: 0x1702419b0, Key path: status, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x170242850>
)'
*** First throw call stack:
(0x1823defe0 0x180e40538 0x1823def28 0x182e3b160 0x180e5e134 0x1822bab28 0x18238acec 0x1822bada4 0x183d25074 0x188575c9c 0x100031928 0x1812c959c)
libc++abi.dylib: terminating with uncaught exception of type NSException

Optional methods in VersaPlayerPlaybackDelegate

Hey, can you make methods of VersaPlayerPlaybackDelegate optional as we have to conform to all the methods even if we don't have to use it.
It's just a suggestion, if it is not possible due to some other reasons please let me know.

Thank you in advance.

How to pass header attributes?

You can send one using 'AVURLAssetHTTPHeaderFieldsKey' in AVPlayer. Does VersaPlayer support. If yes, how? Please guide with example.

Cheers.

Can I use Carthage?

Could not believe cocoapods have to download ~500MB only to be able to install this library. I only use Carthage for all libraries in my project. Is it possible to use carthage in addition to pods?

How to create controls as programmatically?

Hi, I didn't use storyboard for create my video view, i've create view as programmatically. I can create video player with code and i can play video with that library. However i can't create controls with code how to create controls as programmatically?

Video Keeps playing in Background after dismissing the ViewController

When you enter fullscreen mode and back to normal mode. then you dismiss or pop the viewController Player keeps playing in the background which leads me to think the playerView is not released from Memory. This happens with the provided TestProject.
I think there is a retain cycle issue with the "nonFullscreenContainer" property, making it weak solved the problem for me.

PiP Mode Unavailable

How to make PiP work in iPhone? I know it's not supported but I think a library like this should implement its own PiP for within the app navigation.

How to embedding a multiple video into a UITableViewCell ?

Hello thank you for your plugin. I have a problem. I want to use multiple video players on one screen. If I try to do this, all controls are running at the same time. As a result, the UISliders moves all videos.

What's the best way for embedding a video into a UITableViewCell? I'm trying to build something sorta like Twitter/Instagram.

Thank you.

Crash on Observer


Crash

You can easily reproduce if you quickly show/close the player. For now, I am adding guard for self object but please fix it in the next version.

how to add controls to player

@josejuanqm I want to start off by clarifying a few things, I was not trying to be disrespectful, nor do I understand where in the above message I was disrespectful. What I was, however, frustrated, not at you, but at my own ignorance/incompetence of not figuring it out. As for you, I have nothing but the highest respect for 1. spending the time to build this great project and providing it for free and 2. spending the time to continue to maintain it answer/fix issues.

As for your update, it works perfectly! thank you!!!!!

you my dear friend, have my highest respect!

wishing you a wonderful holiday season.

Originally posted by @forTheSakeOfLogic in #17 (comment)

having trouble adding controls to player

Hi everyone, got the sample project to work, but no controls. how do I add controls to the player? do I have to do that programmatically or through storyboard?

can someone show one example of at least one control.

thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.