How could I get smooth looping of a progressive video in a way that fits with OSMF?
I'm using OSMF for a media player, that deals mainly with short swfs and image sequences but have come to a limitation with videos. Looping videos results in glitches - video is not visible for several frames.
The reason of that seems to be unnecessary flow of actions. When at the end of video NetStreamPlayTrait receives a NetStream.Play.Stop event it initiates netStream.stop(). Then a timer in mediaPlayer results in seek(0) and play(). This results in removal of the video object from stage and another delay while re-buffering.
With google and some tests I know that the solution is to respond to NetStream.Play.Stop with just a call to seek(0). But what is the best way to do that?
Should I build a VideoLoopElement or ProgressiveVideoLoopElement from scratch?
Should I dublicate LightweightVideoElement and the whole org.osmf.net package with my changes?
Is there a clean way to modify LightweightVideoElement and it's traits?
Any issues I should keep in mind?
There is a rather dirty (because involves dealinng with ExcludeClass) but quick way to override PlayTrait the way you want.
If you look into LighweightedVideoElement finishLoad function you may see that all traits are get from LoadTrait.
NetStreamLoadTrait (marked excluded) has a method to set custom trait.
So, using that you may create your own loader and insert a custom PlayTrait through the LoadTrait.
The only problem is that it is Excluded - so you may not treat it as an API that won't change in future.