Jun 10 2008
Flex Videodisplay Component Problems
These are the problems i faced in Flex 3.0 inbuilt videodisplay component. I had tried using it but gave up on it a couple months ago this post is written. I created my own videodisplay component for our application.
- There is no video smoothing option, Very very weird since that was introduced in Flash player version 6.
- You cannot get the netStream.bufferLength property, there is no getter for it. So you cannot display the buffer status.
- If you are encoding flv files which broadcast onLastSecond near the end, it will throw an error.
- Also there was a state problem, the player would go into unresponsive state while seeking or something like that which was completely messing up the video.
There was some else major as well but i can’t remember right now, i think it was the way videos were playing. Anyway i am happy with my custom component, which works perfect for our application.
I have seen that this post is the most popular among the very few posts i have, so if you need any help writing your own video display component i will be more than happy to share my knowledge. Sorry i can’t share the code for the component i have created.
edit: July 20th 08.
Flex component might also give you problems while seeking the video to the end, specially if your buffer is long. lets say if you have a buffer of 20 seconds and someone seeks to the last 18th second then the status will be buffering and since the buffer would never get full. The status of the video will be buffering always and the video won’t play.
In my custom component i had to add a condition to see the seek time and buffer length etc and then accordingly change the status of the video.
I am using FLVPlayback, is there any way to get an event using this?
i think you can listen for events on that component too, not 100% sure though.
Do you know where can I see an example using netStream and NetConnection? I am learning Flex3.
sorry i don’t know of any specific place, google would be your best bet. good luck.
Hi Nayan,
Nayan many people ask questions about performance of flv file.I have the same issue.My files resides on Flash media server.When files are play from client site audio is break.Is it possible we buffered all the file then play from videodisplay component?
And also every time client press replay is glitch again the FMS Server.I want to get rid of round trip again.If you can help us its really nice of you.and if you have any examples please send.
Hi yousaf,
i have never had any problems using a streaming media server with flv files. with a buffer time of 10 secs the videos play just fine. there are lot of things that can affect streaming performance.
make sure you know the bitrate of the files and the general bandwidth of your users etc.
you can buffer the entire movie but then there is no point in using FMS might as well use progressive http streaming.
Nayan
Thanks Nayan for your nice answer.
But nayan i have some issues.We have online Testing System.When we deliver test some users get these issues.But this problem can be solve if you we gave whole question is buffered then played on client site.
is their any mean in flex we store whole flv file then we could play.If there is any please give a small example with your argument.
Thanks.
Yousaf
Guillermo –
http://alainthibodeau.com/blog/?p=65
hi nayan,
dear im working on flex for making live video streaming with flash media server 3.
im having problem, to show the list of videos on the main page. please send me some suggestions if u have some ideas and code regarding this.
Thanx in advance.
i will be waiting for ur reply
hi nayan,
I want to know what is the correct way of calling seek on VideoDisplay component. I want the seek to work always. What precautions have to be taken to work it correctly because often video hangs on seek although playhead updates are reported regularly.
I have a list containing mp4 files and position to jump to. These files are used locally because this is an air application.
Another question is how to clear the VideoDisplay component if no video is being played. I have tried the option of calling clear() method by creating my own custom class but it is not working.
Any help will be appreciated.
hi haris,
if you go through the list of comments, someone has had seeking problem with mp4 files and apparently there is some bug with the flex sdk, in that case you can’t do much, sorry. try switching to flv files encoded with higher bit rate to get past that problem.
you can try pausing the video before you try to seek to see if it makes a difference, i believe the clear works just fine, maybe there is something going on with your custom class.
nayan
I can’t use flv.
Does Flex SDK4 has better VideoDisplay component? Should i try that for solving this problem?
Here is the code for custom video display component.
public class MyVideoDisplay extends VideoDisplay {
private var _smoothing:Boolean = false;
public function MyVideoDisplay() {
super();
}
[Bindable]
public function set smoothing(val:Boolean):void {
if (val == _smoothing) return;
_smoothing = val;
if(videoPlayer != null)
videoPlayer.smoothing = _smoothing;
}
public function get smoothing():Boolean {
return _smoothing;
}
public function clear():void {
if(playing)
pause();
if(videoPlayer != null) {
videoPlayer.clear();
}
}
And this how i am using it.
if(video.playing){
video.stop();
video.playheadTime = NaN;
}
video.close();
video.source = null;
video.clear();
hi haris,
it seems fine but i am not sure why would u want to set the playheadtime to NaN, also when you are calling close your netconnection is also lost so next time you have to do the whole process again.
i have been wanting to try out the flex4 videodisplay component but haven’t had a chance to do that, i would imagine they must have definitely improved it.
Nayan
if i don’t set the playheadtime then on changing the source it doesn’t start from the 0 time.
Let say i was playing A file at 5 minutes and i am switching the file to B then on start it will tray to jump to 5 minutes in B file.
First i was using video.playheadTime = 0 but some one pointed out that it will cause another seek and better way to do is set it to NaN
As i mentioned the above code is not clearing the VideoDisplay Component. I was just tring the video.close if that could help me in clearing the video but to no use. I have tried many was to clear the video but nothing is working.
I think i should try Flex4 VideoDisplay component.
Thankyou
thats very weird, i haven’t had that problem at all with the videoplayer. instead of clearing a dirty trick would be to hide the videodisplay
if you close the netconnection and then call play then your movie should play from start always, though it still doesn’t make sense why it would be any different by just calling a play with different url, i haven’t had this problem at all.
I could have the option of using flvcomponent in my project for palying videos.
Is flvcomponent free of these bugs which have been mentioned above?
i haven’t used it personally so not sure if it has any bugs/lack of features.
I am using it now and its much better than videodisplay(full of all kind of bugs) component.
I also tried Flex4 video but as it is in beta stage i have decided to stick with FLVComponent.
FLV Component also has bugs but seeking is ok.
Video clear is not working with this FLVPlayback component also.
There is no way to set the background in FLVPlayback component.
I am unable to set the source to unload the video completely from this component.
I have found the way to Video clear and video unload in flvplayback component.
Trick is to use activeplayerindex other than 0
if(video.playing) {
video.pause();
video.getVideoPlayer(video.activeVideoPlayerIndex).clear();
video.stop();
}
if(video.state != VideoState.DISCONNECTED)
video.closeVideoPlayer(video.activeVideoPlayerIndex);
video.activeVideoPlayerIndex = 1;
video.visibleVideoPlayerIndex = 1;
cool, i haven’t even heard about this property. glad to know you have got it working.
Hey we can smooth the video in flex 4
try this..
vPlayer.videoElement.videoObject.smoothing = true;
Where vPlayer is the id of
i am very new to flex. Now i am facing an issue which is struggling me a lot.
he following sample code works fine with AIR 1.5 but throws a CONNECTION_ERROR when AIR2 beta is used.
Please give your suggestions/solutions regarding the same.
Code:
This is my problem. http://forums.adobe.com/thread/577692 please give me a suggestion
Thanks in advance
Hello i am setting the value of playHeadTime to 10. But the video starts from 15 s. It is always starts from a different playhead of whatever the playheadtime i set to it. How can i Fix that????
make sure you have metadata injected into the video, use flvtool to do it. you can verify that by listening to onMetadata event and trace out the keyframes and their times.
I want to make a videoDisplay with buffering and the buffering is shown.
Anybody have idea how it is possible.
Hi.
I see you are expert of VideoDisplay component. I have a problem also. I have a button which moves the playhead forward to the next key frame. It works fine when video is playing. However when I press this button few times before play button, video cannot starts to play. I can see that playhead is moving but video isn’t playing. Any ideas?
Thanks in advance.
Never mind. I’ve just set autoPlay to true and everything works fine. Wired but works.
hi
i have created player . i am playing video (flv/mp4)using rtmp protocol or fms i am facing one problem . i play advertise video after pausing main video . i am pausing video at every 30 seconds.but problem is here playhead is moved more from actual position after completing advertisement video .so please tell me solution about this problem and help me
Thanks in advance
hi , i`m not able t0 start my mp4 player & when i try to start it simply shows loading ,so wat i can do it to start
10,1,82,76 version of flash player fixed the problem with video not moving while playhead is moving for me. There was similar bug in flash player 9, but there it caused fastworwarding of the playhead and video not moving.
Seems indeed a player problem and not sdk. Not that there aren’t problems there too.
here is the solution to make the flex video smooth using videoDisplay component
http://askmeflash.com/tutorial/8/how-to-smooth-resized-video-in-videodisplay-component
Hi Nayan,
Thanks for posting this useful article. I need your help for solving one of my problem.
I am using Flex VideoDisplay component to play videos in my application. You can imagine the application to be similar to youtube having a list of videos from which user can select the video to be played.
The issue I am facing is that the first 10 videos that user selects play perfectly fine. But the 11th video that the user selects from the list does not play. Once this happens the controls on the video player (pause, stop, slider etc.) do not function. Whatever action user does, the player still plays the 10th video. The only way to stop this is by closing the application and starting the application again.
Please help me find what is causing this issue.
Thanks,
Praveen.
Unquestionably believe that which you stated. Your favorite justification seemed to be on the web the simplest factor to understand of.
I say to you, I certainly get irked whilst people
consider concerns that they just don’t understand about.
You controlled to hit the nail upon the top as neatly as outlined out the
entire thing with no need side-effects , folks can take a signal.
Will likely be back to get more. Thanks