Code Monkey home page Code Monkey logo

Comments (8)

MrZeeee avatar MrZeeee commented on September 21, 2024

you should use code :
self.view.addsubview(videoPlayer)
self.view.bringSubview(toFront:videoPlayer )

from aspvideoplayer.

andreipitis avatar andreipitis commented on September 21, 2024

Hi @langsem ,

It looks like you have two ASPVideoPlayerView objects, one created by Interface Builder with an IBOutlet (videoView) and the other created by yourself in the code (videoPlayer).

If you want to use the outlet, you should set the URL on videoView and you can remove the second one (videoPlayer).

If you want to use the object you instantiated in code you could use the snippet provided by @MohammadrezaZamanieh , just remember to change the frame as well:

videoPlayer.frame = self.view.bounds
self.view.addSubview(videoPlayer)

Also keep in mind that ASPVideoPlayerView is just a view with no controls, so you need to call playVideo() on it to start the video. If you want the player with controls, use ASPVideoPlayer instead.

from aspvideoplayer.

langsem avatar langsem commented on September 21, 2024

dident quit understand this It seems that I still have the problem

from aspvideoplayer.

langsem avatar langsem commented on September 21, 2024

should I set the class of view in storyboard to ASPVideoPlayer?

from aspvideoplayer.

langsem avatar langsem commented on September 21, 2024

also If I decide to use the ASPVIdeoplayer with controls I have to use an array of URLS, and I only have one that its been delivered by recorded video from firebase

from aspvideoplayer.

andreipitis avatar andreipitis commented on September 21, 2024

I'll try to address all your points:

dident quit understand this It seems that I still have the problem

It's probably better if I explain this with comments in your code.

class EditVC: UIViewController {
    
    //Outlets
    @IBOutlet weak var postBtnOutlet: UIButton!
    //You have a video player here, instantiated by InterfaceBuilder. Let's refer to this as VideoPlayer1
    @IBOutlet weak var videoView: ASPVideoPlayerView!
    
    
    var selectedImage: UIImage?
    var videoURL: URL!
    //You have another video player here, instantiated by yourself in the code. Let's refer to this as VideoPlayer2
    let videoPlayer = ASPVideoPlayerView()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        //Setting url on VideoPlayer2, but VideoPlayer2 is not added to the view hierarchy so you won't see anything. 
        //You should change this to use VideoPlayer1 (the videoView variable)
        videoPlayer.videoURL = videoURL
        
        videoView.readyToPlayVideo = {
            print("Video has been successfully loaded and can be played.")
            
        }
        
        videoView.startedVideo = {
            print("Video has started playing.")
        }

should I set the class of view in storyboard to ASPVideoPlayer?

If you wish to use the ASPVideoPlayerView instantiated by InterfaceBuilder, yes you need to set the class of the view to ASPVideoPlayerView in the Storyboard.

also If I decide to use the ASPVIdeoplayer with controls I have to use an array of URLS, and I only have one that its been delivered by recorded video from firebase

You can still use ASPVideoPlayer for this, all you need to do is pass an array with one item in it (your url). ex. videoURLs = [videoURL]

from aspvideoplayer.

MrZeeee avatar MrZeeee commented on September 21, 2024

@andreipitis how can i get the Total Time of Video? and player stream the video? how much buffered?

from aspvideoplayer.

andreipitis avatar andreipitis commented on September 21, 2024

@MohammadrezaZamanieh If you use the ASPVideoPlayerView class, you can get the duration of the video by using the videoLength property.

The ASPVideoPlayer class does not have a method to get the duration, however you could pass an array of AVAsset and you could get the duration from the assets directly.

I don't think there's any way to get the amount of bytes buffered unless you use AVAssetResourceLoaderDelegate with your AVAsset and implement your own video loading logic.

from aspvideoplayer.

Related Issues (20)

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.