Streaming audio in A-frame - aframe

I am building a multi-user experience in A-frame using NAF, and I have some positional audio containing music tracks in different points of the scene. I'm trying to figure out if it's possible to make it that the music is listened simultaneously by all the connected users. It is very important that they are positional, since I need several audio sources in the scene. At the moment, the tracks start when you enter the experience, so each person hears them from the start when they access the scene. This is the file that I'm using right now: https://glitch.com/~indigo-roomy-supermarket
I tried with the broadcast-component, but didn't manage. I thought of trying a workaround using a stream of twitch and hiding the video, trying to project it to a primitive, but also doesn't work so far (just managed to attach it to a div over the scene, I can hide the video but the audio would never be positional). Here the file where I tried it (not networked, but it should be the same): https://glitch.com/~twitchtest-01 I know that there's the option of connecting vimeo to a-frame using this: https://github.com/vimeo/aframe-vimeo-component but the audio itself is not positional, so it doesn't really solve my problem (also, I don't know if it would work with vimeo live).
If somebody knows a way to do this, I would greatly appreciate if you can share your wisdom. Thanks a lot!

I don't think that's easy.
Assuming you have streaming audio servers at your disposal like this then the way I would approach this, is:
fetch an audio stream and once the download returns, get the source buffer
override the source buffer of your positional audio element (something like this.el.getObject3D('sound').children[0].source.buffer) with the newly created audio buffer.
This might work.
If it doesn't, then create you own audio element component by using positional ThreeJS sound directly with setMediaStreamSource.
My assessment would be that this takes several days just to prototype alone. Having said that, I am pretty sure it's doable.

Related

How to record the screen application in flex (Fms)?

"Hi!
I have an application with webcam, chat and more, and i need to record the screen aplication in server, for the client not have to upload the result.
Can some one help me?
Thanks"
What I want is to know how to record the images shown in the Flex application (only inside the swf).
Check out the same question over at Can Flex/Flash Record the Screen?, however I disagree with them. You can render the contents of a movieclip into a bitmap image. The stage is one such object you can render, therefore theoretically you could constantly be rendering these into sequential bitmaps, but you would need some alchemy like encoder to get around the performance hit.
By far the easiest way to go is to record the mouse movements, click actions, or use a insanely well build command pattern to re-recreate the experience elsewhere.
Google as3 command pattern. Good luck!

Export animation to movie

I am creating effects in my AIR application using actionscript like fadeIn and fadeOut. is there any way to export those animation to movie format like FLV or AVI using actionscript?
Thanks
I don't think there's going to be any way to do this on the web unless you stream the data to some sort of server like Red5 or Flash Media Server or something along those lines. If you're just looking to capture the effects and can build/run the app as an AIR app you can probably use the class found here http://www.zeropointnine.com/blog/assets_code/SimpleFlvWriter.as.txt to get it to save the data to a file. You can use (can't post multiple links damn stackoverflow for not linking my accounts correctly...) google "BitmapData draw flex reference"
in order to draw the stage to a bitmapdata object then you'd have to push that data into the SimpleFlvWriter.as (not as simple as it sounds :) ), sorry don't know of a boxed solution for this let me know if you're able to make anything of it and good luck! oh also as an aside you may be able to get away with just using something like SnagIt depending on the fidelity you're looking for.

How can I seek to an exact point in a Flash video without a Flash Media Server?

Is the Flash Video (or Flex VideoDisplay) component capable of seeking to an exact moment in a video?
It seems to always 'snap' to keyframes (which is understandable). I'm just wondering if there are any mechanisms in the video classes for seeking to exact frames, ie it should do the translation from keyframe to specific frame in the background rather than having to actually play the video forward to the desired frame.
This is not a streaming file and has nothing to do with buffering. The player is just downloading a movie file from the web and playing it from memory.
Thanks!
You need a streaming media server to jump to an exact moment in the video.
Otherwise you are stuck using progressive downloading, which will download every moment between the first one, and the moment you want to jump to.
You do not need to use Flash Media Server, though. Red5 is an open source alternative.
I do not know specifics on the code needed to jump to a specific point, though.

.NET : How to Create thumbnail from flash

Is there any way where i can create a thumbnail image from a flash movie file(flv /swf) [NOT FROM A VIDEO File ] in ASP.NET ? Any samples of implementation ?
you can use ffmpeg to create thumbnails of the flash video
For .flv you can use ffmpeg to convert parts of the video (e.g. one frame) into an image (sequence)
I've used it as command-line application by calling Process.Start(), but there is at least one wrapper for .NET (I haven't tested it myself):
http://www.codeplex.com/ffmpegdotnet
For .swf I don't know any way to achieve this without some Adobe tool.
for flv it can be done easily, as others mentioned ...
for swf, it depends HIGHLY on the swf ... if the swfs visual appearence is determined by code, there is no other way than to embed a flash player in you app and either let the flash player make the snapshots, encode them as JPEG/PNG, and send them somewhere using TCP or LocalConnection (a flash<->flash communication connection, which can be used with C# as well) or try to somehow grab its output buffer yourself ... the first possibility should be no more than 10-20 lines of actionscript code ... don't know about the latter ...
other than that, you might use an external command line converter ... there are a few floating around the web ...
greetz
back2dos
Take a look at this article, it should point you in the right direction. It uses SharpFFmpeg to extract thumbnail images from movie clips from a variety of formats.
the only way to get an image, is to use a full flash client that starts playing and allows you to capture the first frame.
I would take a close look at flirt (they actually have an example that renders pngs)
Maybe some of the other flash libraries may be of help ( swfdec gnash swift tools gplflash)
Gnash is probably the best choice since its the most mature project out there, but i do not know how easy it is to integrate into command line tools or into your own projects.
We have been working on this in my company, and we got a proof of concept working pretty fast (but the project we made it for is on hold right now). I am not able to share the code, but I can give you some pointers.
It is not pure ASP.NET, but maybe you can still use it. We made a windows service that can be called from ASP.NET.
Basicly you install the flash plugin on the server, the windows services can then simply open the swf through the swf ActiveX component and then you can grap a picture of the whole thing. It works pretty well, notice that you do not have to actually render the ActiveX component on screen to capture the picture.
Check out this post. It does not tell you everything but I guess it provides the ground work required for it. You probably have to figure out how to get the object tag out of the flash-html you are trying to download from a web page. After that you'd have to figure out when to capture the frames. Its a long ride however. You don't need the asp.net part. Just concentrate on the windows project part. Hope this helps. :)

Play flash one video on top of another?

I'm looking at a project that requires the ability to play one flash video over the top of another... sort of like an animated watermark, where the video on top has transparent regions ans may not be the same width/height as the one underneath.
Using Flash/Flex, can this be done in a web-app at real time? Or would you have to use an offline server app?
EDIT: This is not an HTML question. It's about making a simple video-editing kind of tool solely in Flex. Maybe I want to overlay a video of a galloping horse over a video of passing scenery or something. Ultimately, being able to output a single mixed video is useful, but for video editing that's too slow, real-time playback as the position of the overlay video is changed would be needed.
Hope this clarifies things somewhat?
Put the 2 videos on different layers inside your fla. The video files will have to be .flvs. Make sure the alpha channel is encoded in the video that's meant to go on top... this is done using your encoding program, like Flash Video Encoder. This is probably why it's not working for you right now.
I haven't done much flash work lately, but what I remember of flash (and I assume this is part of flex) you could draw in several files and place them on different levels, like a z-index.
If you need some sort of real-time keying or something of that nature, that is beyond my knowledge of flash.
You may be able to use CSS with z-indexing to do this through basic HTML/CSS means as well. But I would look to having flash do all the heavy lifting of layering, if you can.
I don't think you'll get such features,
Well, I am thinking, why you need to play flash files overlapped on each other .. If you want some water mark (static or Dynamic content), you can have it in a single flash file, you need not overlap the two files for that ..
Even if it was possible to make two flash files overlap on web-page, it is not recommended as good practice, because it needs lot of data to be transfered over to browser(in worst case, 2 files, so double the data), in-turn introducing more delay to load the page.. it is a degradation to your own web-page .. Instead try to merge files (image or flash) to save the amount of memory to be transfered via browser ..

Resources