Comments (8)
you should use code :
self.view.addsubview(videoPlayer)
self.view.bringSubview(toFront:videoPlayer )
from aspvideoplayer.
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.
dident quit understand this It seems that I still have the problem
from aspvideoplayer.
should I set the class of view in storyboard to ASPVideoPlayer?
from aspvideoplayer.
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.
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.
@andreipitis how can i get the Total Time of Video? and player stream the video? how much buffered?
from aspvideoplayer.
@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)
- 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.