Titanium Mobile Select File - file

I need to get a dialog box to open, to select a file.
To save a file, I need the user to choose a filename to save to
To load a file, I need the user to select an existing file
I can not find any file dialog in the API. Is there a method to popup a file select dialog?

First: This would only work on android since iOS doesn't allow this. (Of course you can do this but on iOS this doesn't make sense since files cannot be accessed by other apps and there is no SD card).
Unfortunately there is no File Dialog available in Titanium. You can check Appcelerators's market place for existing plugins or you try it on your own.
On Android you should be able to read the contents of SD card and display them in a tableview. All you need is Ti.Filesystem API. It allows reading and writing of files to SD card. But be careful: there were some changes in Android 4.1+ so that it seems not possible to share files with other apps since you can't make them globally readable. (It's not possible to share this File URL with an intent, i tried this. You need a ContentProvider for that, which is not easily to implement with Titanium since it requires native extensions.) But it may be possible that they are readable with another File Explorer.

Related

How to play a .ts file in Edge browser with Apache2

I use Apache2’s mod-autoindex to build a directory listing of files in a folder and MS Edge to display the list. When I click on a .mp4 file, Edge opens a video player embedded in the browser and correctly plays the video. When I click on a .ts file, Edge again opens the embedded player, but nothing plays. I have installed the MPEG-2 Video Extension app from the MS Store and Windows’ built-in Movies and TV app now successfully plays both .mp4 and .ts files when I select them from within Windows Explorer. But Edge still can’t play the .ts file.
The html generated when I click the .ts file includes the element <source src="https://my.site/foldername/filename.ts" type="video/mp2t">
I conclude that whatever player is invoked by Edge doesn’t know how to deal with the video/mp2t file type.
Can anyone help me find a way to either (1) change the way Apache2 generates the html to specify type="video/.ts" or (2) cause the file click to invoke an external player such as Windows’ Movies and TV app rather than Edge’s embedded player?
You just can't play .ts video file in Edge because it's not supported by Edge. From this doc, you can see that only Safari supports MPEG-2. Besides, MPEG-2 Video Extension can only help play MPEG videos in video apps, not Edge.
For your questions:
video/mp2t is the right MIME type for .ts file. You can't change it to video/.ts which is wrong and useless.
You can't open the default media player without downloading the file. So I think it's impossible.
Since my OP in August, I discovered and implemented a somewhat complex, but perfectly functional way to do what I wanted to do. Herewith, a summary of what I did:
Tiring of the limitations of Apache2’s mod_autoindex, I developed my own custom index.php to replace it. Once I had full control over the format and content of the index, I discovered this SO thread wherein #Jun Hsieh provides a detailed discussion of this former MSDN link, which describes the process for Registering an Application to a URI Scheme.
I followed those instructions to create a custom URI handler that will invoke a DOS batch script on my client. Then I coded my index.php to create an HTML anchor with an HREF that invokes my custom URI, including the path to the desired file. When the link is clicked, the browser invokes the URI handler, which invokes the DOS batch script, which validates the file name and proceeds to invoke Microsoft’s MediaPlayer, which includes a codec that can play a network-resident Transport Stream (.ts) file directly, without requiring it to be fully downloaded to the client. The MediaPlayer also has user controls superior to those available in the video player embedded in the Edge browser.
Of course, the custom URI handler is not limited to invoking Microsoft's MediaPlayer and could invoke any app installed on my client PC.
Note that the browser (in this case Edge) will percent-encode the file name passed to the URI handler (i.e. spaces are converted to %20, etc.) so file/folder names that include ‘special’ characters (such as almost every non-letter/number) must be decoded upon receipt to remove the encoding before passing them to the desired app. File/folder names that include characters such as semi-colon, single-quote, and similar characters (perfectly legal in Windows file names) are particularly problematic and must be appropriately handled by the app invoked by the custom URI handler.
Of course, my solution works only on a Windows client, which is OK for me now because I currently do not have any Linux clients on my home network. But believe that it may be possible to create custom handlers on Linux clients as described in this post.
Yes, I’m aware of the potential security risks of this implementation. But my web server serves only the local network within my home. And it now allows me to use a browser as the single UI to browse and stream web content as well as local content. Just what I had been trying to do. Perhaps others will find this information of interest.

Can't play godot game as a software in pc

I made a game in Godot and exported it in release mode in Desktop as exe file.
But, it also created a .pck file and a highscore.data file.
I want to create it as an installable application and I don't want the highscore file in front.
What can I do? I also want to publish it.
I am new in Godot and this is my first game.
Installers are usually wrappers, aside applications that extract the main app to specific directory. Godot doesn't provide functions to create one. If you really need installer, you can write one or just generate with tools like NSIS, Inno Setup and others...
Separate .pck file can be embeded by enabling "Embed Pck" option in export settings.
Screenshot
I'm not sure what highscore.data file is, but it looks like something creating from code. Use user:// prefix (like user://highscore.data) for file paths to create them in app_userdata directory (more in docs).
So if you use this two options, you will get a single .exe file with game.

Create a binary file extension reader for mobile

It is an ancient binary file extension, actually a video file created by Inter-Tel Web Conference software. It contains a screen recording video and voice audio, and also can capture the keyboard chat log, attendees and the document manager window during a conference. It can be played with Inter-Tel Collaboration Player, a standalone application included with the Web Conference software package.
What I am trying to do now is finding a way to play these files on mobile, although Inter-Tel Collaboration Player offers exporting the files in AVI format, I want to know how to make a command line script for that because the application have lots of problems with Windows 7,8,10 and don't have a Mac OS version.
What is the way to create a new player for that kind of extensions?
"Linktivity stopped support on this app, http://linktivity.com even disappeared from the web..."
It seems they were bought out by Mitel Software so now everything is under the Mitel brand name.
"I just want to find a way to manipulate this file extension, a new good player for mobile and computer"
To open/edit those .lrec files with modern software you'll have to look at their :
Collaboration products.
Unified Communication products.
I tried :
To contact them just to double-check facts but they expect a realtime phone conversation with a salesperson so it wasn't an option. I'd be a fake potential customer, but you can provide a real-world issue (with background details) to see if they can solve it.
Also downloaded for Android the MiCollab app but it needs login details before even starting anything (so no progress to just check if an .lrec file from PC would open within Android).
Export videos for mobile playback :
I've tried the desktop software. Unfortunately it does not accept external commands so there is no way to make a script that takes multiple lrecs and gives back multiple AVI.
The only option is to extract frames from .lrec bytes and use a tool like FFmpeg to combine the images (since appears to do image grabs as frames) into one .MP4 video. MP4 is then playable on mobile devices.
Also any of your existing AVI files should be converted with FFmpeg to MP4.
You can download FFmpeg for Windows here (just the big blue button, ignore other options).
Copy the ffmpeg.exe file to some folder like c:\ffmpeg and put your avi's there.
Now open Command prompt and do cd C:\ffmpeg to reach folder, then type : ffmpeg -i filename.avi filename.mp4 (replace filename with preferred for input and output)
If you know how, just include ffmpeg.exe path to Control Panel PATH settings so that FFmpeg can be accessed from any folder (no need to move files to its own folder).
PS:
I am still researching how to get the frames it's an akward format without the specs (bytes order is Big Endian but then entry values are filled as Little Endian, then also not sure whether to reverse every two or four bytes cos it's mixed up like that etc and the pixel bytes themselves seem to have compression but it's not JPEG more like ZIP or whatever). Only confirmed bytes so far are for video width and video height. It seems doable though if the .lrec only contains screen recordings.
After some research, I found that Media Player Classic can play .lrec files. I don't know, if this helps you a bit.
For a own video player for your company, you would need the encoding infos or a decoder directly from Inter-Tel since they own the licences, without it you can't create one.
Edit: Deprecated info see comments.

Saving Files in CodenameOne

I'm trying to save some screen dumps to internal storage for debugging purposes, but I can't seem to get access to them. When I call FileSystemStorage.getInstance().getAppHomePath(), I get a path that looks something like this:
/data/data/com.mycompany.myapp/files/
But I can't see this folder in the Android File Transfer tool, so I can't drag the files to my Mac. I also tried attaching them to an email using the Message class, but for some reason the attachments never showed up. I notice that a lot of applications store data in folders like this:
/Android/data/com.doubletwist.androidplayer/
If I try to create a folder like this, I run into two problems. First, it's not platform independent. (This doesn't matter much because I'm just doing this for debugging.) Second, it doesn't work. I get an error telling me I need to use the directory returned by FileSystemStorage.getInstance().getAppHomePath()
Is there any way I can save files to a folder that I can actually retrieve them from? It would be more helpful if I had a platform-independent way, but any way that works is fine for now.
File system is a very "unportable" notion. By default app home is a private folder which some mobile OS's including Android 4+ keep private and inaccessible.
Android has a concept of "sdcard" which used to be a physical storage where you could write anything in any directory without a problem. This is no longer applicable for later versions of Android but you can read from the sdcard directory and detect it.
FileSystemStorage has an API to get roots and their types, if you have an sdcard type you can read from there. You can use the FileTree to see the file hierarchy as exposed to your application which can be useful for debugging.

Access a local file in Silverlight

I want to get the string from a local file (probably a Csharp file), which is attached to current project and its build action was set to Compile. Is there any way to do that. I cannot set the files' build action into Resource.
Regards,
Jawahar
I'm not clear which of these two questions you're asking:
Question 1) Can I get the text of a source file used during compilation, after compilation?
Answer 1) You'd need to set the build action to Content or Resource to do that, but realize that means you'd be shipping your source with your xap, so make sure that's what you want to do (i.e. most employers probably wouldn't like this).
You can have the file added to the xap twice by using "Add -> Existing Item -> (pick the file) -> Add As Linked Item (the little drop-down arros next to Add buton)" and set one to Compile and one to Content/Resource to accomplish this.
Question 2) Can I access a local file on the hard drive of a user of the Silverlight application?
Answer 2) Yes, by using OpenFileDialog and having the user choose the file.
Or, if you're in a Trusted Out of Browser Application (SL4 and above), then you can use the System.IO APIs to access files in My Documents, My Pictures, My Videos or My Music (on Windows an Mac) without needing to prompt the user.
Or, if you're in a Trusted OOB app, running on Windows, you can use COM and access the full file system (up to what the user can see permission-wise), again without prompt.

Resources