Hey. I am creating a video player in ActionScript 3 that should be aimed at performance. It should play large h264 videos via RTMP with the least possible processor load.
There is not much control over the video playback part, but my approach is to try not to kill the processor with chrome and other additional parts of the player. I removed FLVPlayback and all components and created my own player from scratch using Video, NetConnection and NetStream, but the NetStream class does not have an update event.
To do this, in order to update the execution line and the expired text field, I have to create my own event that reads from the NetStream.time property and calculates the video progress.
As I understand it, I have two ways I can do this: by creating an instance of the Timer class or by adding a listener for the EnterFrame event. I am looking for the best way to update regularly (every couple of hundreds of ms), which has the least impact on CPU usage. Which of these two options is likely to be the best option?
There is also a third solution, but it seems to me that this is a long shot: create a separate animation, a basic animation that plays independently of the video and only synchronizes with various video events. This will completely remove the regular update, but only as far as I can see in the code. Obviously, the animation is still updating during the game, but I assume that it will be processed at a lower level than the timer. Of course, additional code will be added to keep the progress bar animation and actual video playback in sync, but at least I won't have a timer running 30 times per second.
What is the best way to power the least processor resources?
, , - . , , .
, , , Flash - - . , ENTER_FRAME - , ( , ) (, ). .
, , , ? - , , . Flash , , , - . , N- , , , , , , , . , "" , . (, , ), .
, Frame, . ( .;) , , , , , , .
, ... , , , h264 , ... Timer, ... ... , ( msecs?)... , , 1 10 ... ... enterframe..., , , /, , ... FAR - , ...
Timer
: flash.utils::setInterval (, , , Timer), TimerEvent ( ) ... ...
flash.utils::setInterval
TimerEvent
Greetz
back2dos
Compared to the cost of decoding the h264 video streams, I don’t think that the overhead added by the FLVPlayer component would be so significant.
By the way, avoid the third solution because you cannot know the time of the game. On older machines, decoding will freeze or delay the video.
Source: https://habr.com/ru/post/1713325/More articles:Is there an NHibernate criterion that actually means nothing? - nhibernateHow to make side by side equal in height (CSS / HTML)? - htmlWindows Mobile: Exception in Finalizer terminates program - c #Ошибка MFC LoadString в dll - c++How to target .Net 4.0 Beta using NAnt? - .net-4.0Как создать базу данных SQL Compact 3.5 для Windows Mobile в веб-приложении ASP.NET? - .netWhat happened to the XSD visual editor in Visual Studio 2008? - visual-studio-2008Call C ++ functions from C # /. NET - c #GUI Integration in Console Applications - user-interfaceАутентификация пользователей с помощью SpringSecurity с помощью WebService, для которого требуется имя пользователя и пароль - javaAll Articles