Detecting stopped/interupted video stream with JWPlayer7 - jwplayer7

I've been trying all the error detection with the JWPlayer API, and can't seem to be able to detect if the video stream has been stopped, or interrupted. While watching the video, i turn off my network connection, which (I presume) should trigger an error, but instead, it just hangs until i close the page.
Is there an error that should fire in such a case, or is there some other way to detect when this problem occurs?

Related

NetStream.publish() to AMS ends up with 1kb file

I'm using Adobe Media Server 4.5 and the FLEX 4.6.0 sdk.
I have an .swf application that connects to Adobe Media Server over RMTP, takes audio and video input from the user's webcam and mic, and does a NetStream.publish() to stream the file to the server. The file grows in size as the user records the video. On occasion, the resulting file will end up with a size of 1kb.
What's causing this and how can I prevent it, or otherwise end the session and inform the user that something went wrong?
Edit:
Some additional questions/comments/opinions that might help identify the problem:
This only happens 1% of the time, and I'm not sure what I can use to troubleshoot this. I've never been able to catch when this happens before the log files generated by AMS expire.
My theory is that it happens when the client loses connection somewhere.
As long as the NetStream is publishing correctly, the file will grow in size.
If the file doesn't grow, it should mean that the NetStream lost connection. Seeing as the file is 1kb, the stream must have lost connection immediately after starting to publish.
I also opened the file in Notepad++ and got this:
FLV [SOH][NUL][NUL][NUL][NUL] [NUL][NUL][NUL][NUL]
Another theory is that something has a chance to overwrite my file, but this is unlikely
Have the same problem, but 0.001% of the cases.
The most common problem occurs because of a microphone.
Need to check the microphone before publishing a stream.
Another possible problem:
Client interrupts the flow - NetStream.Record.Stop
Exits the application - onDisconnect
Сlient disables the microphone / camera
"The FLV segment cache is full"
Can warn if called onUnpublish event on the server.
I also use the timer after the publish () method on the client side, if after 3-5 seconds NetStream.Record.Start event is not called, then the client has a problem and it should be prevented.

swf file terminates automatically after publishing

I create app using flash cs 5.5. It works fine. Then I started using flash cs6. The app was running fine until today. It runs fine but the problem is when i tried to publish it, it start playing but after some time(about 30 secs), swf file terminates itself. There is no problem in using cs5.5. It's just when i tried to publish it, it runs and swf file is close itself. Do any one have any idea what might be the problem ?
When you say "the swf file terminates itself", are you talking about the standalone flash player? Normally if this happens, it's because an error was thrown, but if you're not using the debug player, you won't see it, it'll just close.
Download the debugger player here: http://www.adobe.com/support/flashplayer/downloads.html and run your swf in debug mode (so all the debug symbols are present and you get the most complete error message). This should give you an idea of what the error is, and where to go to fix it.
NOTE: to know if you're running in the debug player or not, right-click on the swf in the player, and if you see an option for "Show redraw regions", then it's the debug player

Flex Security Sandbox Violation just started happening

I have an http handler built and running on my website server. Code in flex generates a http request then navigates to the handler, which generates and streams back file information for the user to download.
Basically the request sends image data and the return result is a pptx stream with the image data in a powerpoint slide.
This worked fantastically this morning until about an hour ago. I have no idea what changed, but every swf I am building which attempts to access this handler is now giving me:
* Security Sandbox Violation *
Connection to https://g1.localhost/Turm/BounceBack.aspx halted - not permitted from https://g1.localhost/Turm/FlashApps/ImageAndExporting.swf?debug=true
I even fully qualified the BounceBack.aspx name (it was a relative url until just now) in case something was confusing the flash player, but as you can see, the url request and the swf are loaded from exactly the same domain (even the same virtual app in the web domain).
I have even added the physical filepath as a 'trusted folder' in my flash player security settings.
What gives? Anyone have any suggestions?
Using the Apache 4.9.1 SDK and latest version of flashplayer.
As mentioned, this worked all day yesterday and this morning. I cannot figure out what has changed, but am having no luck resolving the issue, source code has not changed.
Finally figured out what changed. I move the navigation to my ASPX handler into a seperate method that delays invoation till after a UI update. Becuase I use the same ui components for printing as well as exporting, I tested the updates with the print feature and that worked without error. About an our later, I noticed the handlers were failing. Since the url request is not handled inside a UI interaction event (Like MouseEvent.CLICK) the flash player was preventing the call. Once I moved the navigation back into the event handler, the sandbox violation went away.
If you ask me, not a very good error message due to the actual problem encountered, but ... you learn something every day.

In flash as3 webcam recorder how to reconnect or republish after connection loss

I have a flash as3 based webcam video recorder that publishes the webcam video stream of a user to a Flash Media Server (FMS). The trouble I have is that when the connection of the user drops due to erratic internet connection, the recording stops abruptly in between and the video file is more often than not, corrupted. I can use the NetConnection.Connect.Closed and NetConnection.Connect.NetworkChange events of the NetConnection class to detect a connection drop and reconnect to the server without any problems. But on attaching the newly reconnected NetConnection object to the NetStream object, the recording is reset and starts all over.
In the case of playback using an FMS, the re-attaching of a new NetConnection to the NetStream, there are ways to resume the playback from the last position as shown in the documentation here: http://help.adobe.com/en_US/flashmediaserver/devguide/WSae44d1d92c7021ff-1f5381712889cd7b56-8000.html. But while publishing / recording, I can't resume the recording once i have re-connected. Is there a way to work around this? Ping me in the comments if the question is not clear. Thanks.
Note, I've never done this, so I don't know how it would work w/files that are corrupted, but there is an option to append to an existing stream (or append with a gap), when publishing a NetStream. The second parameter of the publish() method specifies how to publish the stream:
ns.publish('myStreamName', 'append');

How to detect that streaming stopped AS3?

I have a flash app and I need to detect whether the streaming of data has stopped.
That means the connecton is still opened but the stream of data is cut of i.e no data in the pipe.
So I am asking which of these NetStatus events coresponds to this case?
NetStatus events from here http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/NetStatusEvent.html
I have used the "NetStream.Play.Complete" event but it doesnt work i.e doesnt detect this event
There is no "NetStream.Play.Complete" status (see your own link). Recently I've been working on a video player (which is based on NetStream class, too) and had a problem with identifing the video playback COMPLETE event. What seems to be working well for me is the "NetStream.Play.Stop" event. It doesn't get fired when you explicitly stop the streaming, but at the end of playback - at least for the video streaming, so it might be useful for you, too.