Comments (9)
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.
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.
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.
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.
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.
@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.
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.
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.
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)
- rtsp/rtmp support? HOT 2
- Cannot pause when pause button is clicked for audio HOT 2
- Default Font HOT 2
- Show time left instead of length of video HOT 2
- ASPVideoPlayer has no sounds when play video HOT 5
- Property 'self.newVideo' not initialized at super.init call HOT 2
- can not seek video when put in sliding panel HOT 2
- Playing multiple video at same time. HOT 2
- 'CMTime' has no member 'kCMTimeZero' HOT 2
- mp4 video coming from the URL not running HOT 3
- Hi ..How would i know if the view is playing video in ASPVideoPlayerView . HOT 1
- Property 'self.readyToPlayVideo' not initialized at super.init call HOT 3
- How can i delegate didpressednextbutton? HOT 1
- Resize Button Is Outside of View HOT 2
- How to create custom view on video player HOT 1
- Foreground problem HOT 1
- used seekTime - getting small struct HOT 1
- Background Video need to stop. HOT 1
- No playback speed (1.5x,2x,2.5x) adjuster
- Error loading video.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspvideoplayer.