Copy link to clipboard
Copied
I am struggling with looping an mp4. I've tried using flvplayback but there's always a stutter between replays, which I've read is unfortunately common. So I've attempted to use netstream. My video runs once and stops. I've been struggling with this for a while. Here's my code...hopefully someone can point out my error.
import fl.video.*;
import flash.events.NetStatusEvent;
var video:Video=new Video(1920,1080);
var nc:NetConnection=new NetConnection();
nc.connect(null);
var ns:NetStream=new NetStream(nc);
addChildAt(video,0);
video.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(event:Object):void{};
ns.client = listener;
ns.play("Cursed by the Rains.mp4");
// Loop
ns.addEventListener(NetStatusEvent.NET_STATUS, NCListener);
function NCListener(event:NetStatusEvent){
if(event.info.code =="NetStream.Buffer.Empty"){
ns.play("Cursed by the Rains.mp4");
}
};
Thanks for trying. For your interest, to get the FLV AME you would install Flash Pro CS6 from Creative Cloud. That included AME. All the CC versions of AME don't do FLV.
I have done video mashup tools, where the next video needs to start instantly after the current one ends, and it seemed to work (at least with FLV).
One thing to think about is that you could start the next copy at the time it's supposed to start, and not look for a complete event. My mashup tools would work that way, because you
...Copy link to clipboard
Copied
FLV is much more responsive than MP4. If FLV was an option that would be a quick fix. Assuming it's not, try having two FLVPlayback objects, or two netstreams, and have the next copy of the video ready to go when the current copy ends.
Copy link to clipboard
Copied
I'm willing to do FLVs but I think I have to download an older version of AME? What was the last version that you could export flvs? And is there a link to the old versions somewhere?
I did think about doing two netstreams but wasn't sure how to code it up.For instance, stream1 plays and stream2 is waiting in the wings. When stream1 finishes, stream2 plays, but then stream2 would play and stream1 would wait...
Copy link to clipboard
Copied
Colin,
I used an online converter and changed my mp4 into an flv. Using the same code, I still get no seamless loop.
Copy link to clipboard
Copied
Thanks for trying. For your interest, to get the FLV AME you would install Flash Pro CS6 from Creative Cloud. That included AME. All the CC versions of AME don't do FLV.
I have done video mashup tools, where the next video needs to start instantly after the current one ends, and it seemed to work (at least with FLV).
One thing to think about is that you could start the next copy at the time it's supposed to start, and not look for a complete event. My mashup tools would work that way, because you have to set things going at the time they are needed, you can't trust that waiting for the previous one to end is going to be seamless enough.