How to capture a streaming video display and save it to disk in Flex Builder 3? - flex3

I've been looking for a solution to my problem for a while and didn't get the answer.
I have a page with a VideoDisplay object and a "Take screenshot" button. I would like to get the screenshot from the streaming video and save it but I'm getting an error:
Security sandbox violation: BitmapData.draw: http://xxx/xxx.swf cannot access rtmp://xxx/xx/xx/. No policy files granted access.
The domain of the website from which I'm capturing the image and the rtmp is the same.
I'm using ImageSnapshot class to capture the screenshot. This is the function responsible for taking the screenshot:
function takeSnapshot()
{
var imageSnap:ImageSnapshot=ImageSnapshot.captureImage(mainPlayer);
var imageByteArray:ByteArray=imageSnap.data as ByteArray;
var fileRef:FileReference=new FileReference();
fileRef.save(imageByteArray, "screenshot.png");
}
I've got also a cross-domain policy file with a lin:
<allow-access-from domain="*" />
I'd be grateful for your help.

It seems someone has figured it out.
He was having an issue with not connecting to the stream correctly
Have a look

Flash Player cannot access bitmap data
or sound spectrum data for media
loaded from RTMP sources, although it
can display and play bitmaps and
sounds loaded from these servers.

Related

How to enable video from /.attachments/?

I'm gonna enable a video on Azure Wiki page. This video is not public, so I have attached it to Azure Wiki page like a image and the file was uploaded to /.attachments/ folder. Is it possible to use it during creating a vide section?
I have tried the following options but it now working as expected - it looks, the source was not recognized (Unable to play video)
::: video
/.attachments/2022-08-03-13-58-19-ase-e9465a68-acd2-4f73-b11a-5cc52c96d8c5.mp4
:::
<video src="/.attachments/2022-08-03-13-58-19-ase-e9465a68-acd2-4f73-b11a-5cc52c96d8c5.mp4" width=400 controls></video>
You can treat the video as any other Wiki attachment like this:
[2022-08-03-13-58-19-ase-e9465a68-acd2-4f73-b11a-5cc52c96d8c5.mp4](/.attachments/2022-08-03-13-58-19-ase-e9465a68-acd2-4f73-b11a-5cc52c96d8c5.mp4)
However, it's conceivable you may loose some of the intended video functionality when you treat it as an attachment.

Safari not retrieving mp4 video from cache, and sometimes timeout when downloading the same resource

I'm running a VueJS application that displays a full screen story of videos. I don't create as many tag as number of media in my story : I'm just changing component video sources each time I play a new video.
But it looks like Safari (Desktop & mobile) still does not cache HTML video once loaded : when I'm playing again a previous media, Safari is downloading again the asset. Instead of getting from cache like Chrome does.
The same issue has already been reported here but sill no correct answer.
Safari even stops downloading the final bytes video (producing a sort of timeout) when we go back and forth quicky in the story, so the story looks stuck.
Here's an example link.
Does anyone know a good alternative that avoids re-downloading video data at each play on Safari ?
Partial solution
Found myself a workaround that works pretty well if video is small size - all video are less than 3Mb in my case.
The trick is to use js fetch API to download full video, then stream it into video tag.
const videoRequest = fetch("/path/to/video.mp4")
.then(response => response.blob());
videoRequest.then(blob => {
video.src = window.URL.createObjectURL(blob);
});
Contrary to video src attribute, fetch API will get video data from cache if the same video was already fetched before.
Here a codepen demo that can be tested in Safari desktop/mobile (when NOT in private mode).
Pro : Video are now pulled from cache in Safari !
Con : You can't start the video until full data has been downloaded. That's why this solution can be used only for small video (like < 5Mb), else your users may wait a while before being able to play the video.

Audio Streaming in Windows8

I want some help on streaming an audio content on Windows8.I have several URL's which i need to play.Not sure if there is any ready to use API for this or anything else.
Can anyone please help ?
Try this:
Combine this with this.
Basically you create an instance of the MediaElement class with a URI like Uri targetUri = new Uri(#"http://www.bing.com"); which points to your audio.
Since you mentioned "several URLs" you'll need to create some sort of "playlist" (which may just be a collection of URLs). You can subscribe to the MediaEnded event of the MediaElement to know when to go to the next track. You'll also want to subscribe to the MediaFailed event in case the network goes down, the audio file is deleted or the audio file is using an unsupported codec.
Finally, consider adding support for audio to continue running in the background even when your application is not focused. This thread should help.

Generating a random preview image on a HTML5 video tag

Is it possible to capture a snapshot of a video that's loaded using the HTML5 video element and use that as a preview image until the video loads or the play event is triggered? I know about the poster attribute but I want the thumbnail to be self generated, like a random frame from the video. Sort of what YouTube/Vimeo does.
Thanks,
I don't think that this is possible in pure HTML5. Principally because the stream is not loaded when you see the 'object' in the webpage so the client can't get the desired frame.
However, the best option for you is to save / cache the 'random frame' before loading the page and then use it as the poster of the video. This will allow you to reduce the client work and save the bandwith.
check THIS, which is the first thing that I've found (if you're using PHP and you want a 'quick and dirty' way to get the frame)
Update
Apparently HERE there is a solution with popcorn.js BUT it seems that you can't do it in the way that (I suppose) you need.
This because it would be possible to do this only inside the same domain due to browser security issues.

Embedded video in WinForms (AxShockwaveFlash)

I have uploaded a couple of tutorial videos in youtube.
In my winforms application (by using the AxShockwaveFlash object) i reproduce the selected video by the user.
AxShockwaveFlash1.LoadMovie(http://www.youtube ..video1)
Here comes the story.
The first time the user selects a video, reproduction works like a charm.
When the user selects to see the second video
AxShockwaveFlash1.LoadMovie(http://www.youtube ..video2)
the ShockwaveFlash continues the reproduction of the first selection
Try to use
AxShockwaveFlash1.Stop();
AxShockwaveFlash1.Movie = "Your source";
AxShockwaveFlash1.Play();
Pattern to avoid leaving flash arguments behind.
Without knowing how you have integrated the video in your form, the method I would do is using a webBrowsercontrol in the form and embed the video in the control.
msdn on webBrowsercontrol
I had encountered this problem and resolved it by changing the Embed property of the Ax object control to False.
I embed the videos via the movie URL each time as follows:
http://www.youtube.com/v/targetmovie&feature=player_embedded
Works a treat
Tamir,
the video is embedded. Not stored locally
This is because your application is loading flash player loader from the cache and then it's loading the real player from the site , finally this yield a security exception.
In internet explorer , in internet options set to check for new versions of the documents each time you visit the page.
You first need to extract the FLV file like here:
Getting an FLV from YouTube in .NET