Code Monkey home page Code Monkey logo

Comments (9)

andreipitis avatar andreipitis commented on May 23, 2024

Hi @CPiersigilli ,

ASPVideoPlayer uses an AVPlayer in its implementation, so any format that an AVPlayer can play is supported, including .mov. I have used the .mov file from this link to test that it works. If the .mov file at that link works for you, then your issue might be with the encoding of your video file.

from aspvideoplayer.

CPiersigilli avatar CPiersigilli commented on May 23, 2024

I created the file with the iphone video camera: "file: ///private/var/mobile/Containers/Data/Application/204BA506-5798-444A-B578-513536933E35/Documents/myVideo.mov" assigned to the variable firstVideoURL and then videoPlayer.videoURLs = [firstVideoURL]

Unfortunately I get the error: "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value"

Instead using the following code I can see the saved video.

// Create an AVPlayer from the video saved in the filemanager
let player = AVPlayer (url: firstVideoURL)
// Create a new AVPlayerViewController and pass it to reference to the player.
let controller = AVPlayerViewController ()
controller.player = player
// Modally present the player and call the player's play () method when complete.
present (controller, animated: true) {
     player.play ()}

Do you have any idea why it does not work?
Thank you

from aspvideoplayer.

CPiersigilli avatar CPiersigilli commented on May 23, 2024

For your information, I added ASPVideoPlayer by copying the ASPVideoPlayer folder to my project, because I do not like using CocoaPods.
Can this be the problem?

from aspvideoplayer.

andreipitis avatar andreipitis commented on May 23, 2024

Not using CocoaPods shouldn't be a problem.

I tried to reproduce your issue by loading a video from the media library (taken by the camera) but I wasn't able to get the same behaviour.

Is the Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value happening within the code of the framework? If so could you tell me the file and the line?

Does this also fail if you try to set the AVAsset directly using the videoAssets property of the ASPVideoPlayer, instead of using the URL?

It's pretty hard to debug this without actually seeing the code. It would be great if you could make a sample project with code to reproduce the issue and provide me with a link/zip file.

from aspvideoplayer.

CPiersigilli avatar CPiersigilli commented on May 23, 2024

I have modified AVCam of Apple.

See: // MARK: Save Movies nella directory permanente from CameraViewController.swift, where capture and saved video from iPhone camera.

See Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value in VideoPlayVC.

I'm using an iPhone 6.

Zip Code from: click here

from aspvideoplayer.

andreipitis avatar andreipitis commented on May 23, 2024

@CPiersigilli thanks for sharing the code. The issue you are having is not caused by ASPVideoPlayer but by the fact that your videoPlayer outlet (PlayVideoVC - line 14) is not connected with the view in the storyboard.

Once you properly connect the outlet, everything works fine.

from aspvideoplayer.

CPiersigilli avatar CPiersigilli commented on May 23, 2024

Great, thanks! ASPVideoPlayer works fine now.

One more thing... I'd like the toolbar and navigation bar to be shown when the video isn't playing or if it was stopped and hidden when it's playing. How can I make it work that way?

You can download, by clicking the link below, the VideoPlayVC code where I tried to add this feature but it doesn't work as expected

Zipped file: click here

Thanks in advance for your help.

from aspvideoplayer.

andreipitis avatar andreipitis commented on May 23, 2024

Unfortunately ASPVideoPlayer does not have any callback methods for different events yet, so it's probably going to be very tricky to do what you want. I will try to add this new functionality soon.

In the meantime you can use ASPVideoPlayerView. It work similar to ASPVideoPlayer and it provides a number of callback methods for events like when a video stopped, when it resumed, etc. The drawback is that it has no UI Controls.

from aspvideoplayer.

CPiersigilli avatar CPiersigilli commented on May 23, 2024

Thank you for your support. I will wait for the change to your ASPVideoPlayer to implement what I would like to do. Please enter the ability to move your ASPVideoPlayerControls vertically so as not to hide it when it is shown, for example the toolbar.

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.