LibGDX: FileHandle in html - libgdx

FileHandle dirHandle = Gdx.files.internal("audio/");
int size = dirHandle.list().length;
There is 10 files in audio folder.
The above code works properly in Android and Desktop but in Html, size is zero.

Related

How to Reduce wav File-size created by Recorder.js

I am using recorder.js to upload user's audio files on our server. This is working in chrome and firefox both..But our audio file will be around 1 minute and for 1 minute audio file its generating approx 8 MB file which is too large to upload on server..
I have tried to update recorderWorker.js file:
Updated interleave method as
function interleave(inputL, inputR)
{
var result = new Float32Array(inputL.length);
for (var i = 0; i < inputL.length; ++i)
result[i] = 0.5 * (inputL[i] + inputR[i]);
return result;
}
and set channel-count as
/* channel count */
view.setUint16(22, 1, true);
By this above code my file was created in just half size ie of 4 MB. when I play this file in chrome it is working but when I try this file in firefox and windows media player..This is not working..In firefox its giving failed to load and in windows media player giving "Windows Media Player encountered a problem while playing the file." message.
I have created 2 samples:
http://216.245.194.124/recorduploadsample.com/
http://216.245.194.124/recorduploadsample2.com/
First sample will work in both chrome and firefox and after record anything we can play the recorded sound..(This is original code with large file size)
Second sample is working only in chrome not in firefox (Updated above code to reduce the file size)
I need to reduce the file size by changing resolution of the audio file and that should work in chrome, firefox both...Can anyone suggest the solution for this?
Thanks in Advance
The problem with wav is that the files are non-compressed, therefore they take up a lot of space on the disk, just 1 minute of recording can take as much as 10 Megabytes.
The solution to this? Well let’s convert the wav file to mp3. Simply saving the wav file and then converting it will not do. We will need to convert the recording, to mp3, in real time, in the browser.
https://nusofthq.com/blog/recording-mp3-using-only-html5-and-javascript-recordmp3-js/

save file in Blackberry 10 WebWorks html5

I found this https://developer.blackberry.com/html5/apis/blackberry.io.html example that load a file, but, nothing for save a file in html5 webworks to BB10
We actually have a sample that shows how to do this hosted on GitHub.
https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/canvasToFilesystem
The sample shows how to save imageData from a Canvas element to the filesystem, but the actual file writing portion of the sample could be used for any file type.
https://github.com/blackberry/BB10-WebWorks-Samples/blob/master/canvasToFilesystem/saveCanvas.js#L31-L98

Netstream video not playing on iPad

I am building an iPad app using Flash CS6 to compile to AIR 3.3 on a PC.
One of the app requirements is a video player which can be overlaid with other display element - primarily for subtitles.
I am using Netstream to play MP4 video (have also tried FLVPlayer with same results).
Everything works fine when compiled to run in the emulator, but the video doesn't play once installed on my test device - iPad 3.
(I did a simple test a few months ago and got video playing correctly with audio, but that was CS5.5, AIR 3.1, iPad 2. I will return to this setup, but I obviously do also need to support iPad3...)
So, a couple of quick questions first...
Anyone with the same problems?
Do you know if anything has changed recently on iOS that blocks AIR playing video?
I do the usual netstream / netconnection stuff then pass a File.url to netstream.play().
Here are the guts of the code:
var nc:NetConnection = new NetConnection();
var ns:NetStream;
var vid:Video = new Video();
var videoFile:File;
videoFile = File.applicationDirectory;
videoFile = videoFile.resolvePath(Config.VIDEO_DIRECTORY + 'myVideo.mp4');
nc.connect(null);
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false, 0, true);
ns.client = this; // To handle onMetaData & onXMPData
vid.attachNetStream(ns);
vid.smoothing = true;
addChild(vid);
ns.play(videoFile.url);
Publish settings are:
Hardware acceleration :: Level 2 - GPU (have also tried Direct)
Render Mode :: GPU (have also tried Direct)
Device :: iPad
Resolution :: High (have also tried Standard)
Included files :: app.swf, app.xml, assets directory with video / images (images load fine) (tried including .mp4 directly rather than in directory, no difference)
Can any of you help?
I am experiencing the same issue when I started using AIR 3.3. When I attempt to play a video, the app would crash.
When I went back to AIR 3.1, the problem went away and was again able to play the h.264 MP4 video with no problem.
According to the following link, there appears to be a bug in AIR 3.3, which supposedly will be fixed when 3.4 comes out. #See https://bugbase.adobe.com/index.cfm?event=bug&id=3210031
Ok, fixed.
The above code is all correct (works perfectly), but the video file was wrong.
I still don't understand why, and would welcome some response, but I have switched to .flv formatted video and it works fine.
The file I was testing was encoded for iPad and ran fine when played in AIR on the desktop, and when imported to the iPad and played natively.
Any insight to encoding presets (I am running Adobe Media Encoder) for mp4 would be interesting.
i had the same solution, it works with videos included in the build. But if I stream the flv from my server (http) nothing happens...

Image Embed or not Embed? (flex)

Who can tell me when I embed a Spark Image Source? ...
In folloring case in my mobile app. There is an Image (Spark) with a multidpi src. But that's not all... when the device orientation changes, the image source property will linked to another multidpi src (optimized for newOrientation).
in code:
if(landscape)
image.source = multiLands;
else
image.source = multiPort;
embed or not embed

Loading .bmp (Bitmap) and .tiff file in Flash 10 using a Loader

I am developing a Image uploader using Flash 10.
I am using FileReference object to browse images and Loader to show the image:
Sample code:
var tempFileRef:FileReference = FileReference(ev.target);
var oLoader:Loader = new Loader();
oLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoad);
oLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
oLoader.loadBytes(tempFileRef.data);
It works fine with .jpg and .gif files but when I browse .bmp or .tiff file, I am getting the error:
Error #2124: Loaded file is an unknown type.
Is there a way to load and display browsed .bmp images from desktop?
Thanks
BMPDecoder class from Spark lib:
http://www.libspark.org/svn/as3/BMPDecoder/src/com/voidelement/images/BMPDecoder.as
Example of the usage: http://hi.baidu.com/leyhui/blog/item/d12be8b116ec915308230298.html
Regarding TIFFDecoder, it is still work in progress, but very promising one:
http://code.google.com/p/windowsbitmapdencoder/
No. Flash does not support .bmp and .tiff files.
Adobe Help Docs
"The bitmap image formats supported by Adobe Flash Player are GIF, JPG, and PNG."