How to play a .ts file in Edge browser with Apache2 - 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.

Related

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.

Titanium Mobile Select 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.

Use Chrome portable to open a index.html file on the same USB stick for a homepage

IS it at all possible to set the Google homepage to a file located on my USB pen drive?
I can link it though the file path, problem being the drive letter would change depending on the system it is plugged into so a hard coded homepage link wont work.
Im unsure of the syntax to use to make it upen the file -
%USBDRIVE%/Webfiles/index.html
The page is used to help new users navigate the USB pen and get the info/files they require as its aimed as users with next to no IT skills or disabilities
Thanks Guys
You've probably found a solution already, but just come across your question and I recently had the same scenario. I'm assuming you mean on PC.
I solved it as follows:
In the PortableGoogleChrome folder (after portable chrome is setup on the usb drive), there is a default file called parameter.txt. I added the following in order to set the homepage to my local file. It is in a sub folder called 'resources' located on the usb drive root:
--homepage="\resources\index.html"
That's all for the parameter.txt file. That takes care of the homepage setting.
Now to launch portable chrome, I created a windows batch file called launcher.bat also at the root of the usb drive (call it whatever you like obviously!). I added the following code:
#echo off
cd PortableGoogleChrome
"ChromeLoader.exe"
The launcher file changes the directory to PortableGoogleChrome and then loads Chrome via ChromeLoader.exe which takes in your homepage or other parameters in Parameters.txt.
FINALLY, in order to create an application to replace the Launcher.bat file (as I figured a windows application with icon would be more intuitive to run than the batch file), I found a windows utility called bat_to_exe_converter which enabled me to convert the bat to an exe and supply an icon also (having tried to do so in C++, C# but errors because of needing supporting DLL's, this was much more straightforward).
Hope that's of use!

Silverlight 4 MediaElement play sound

I converted a local sound file to a resource, which built this in my XAML:
<UserControl.Resources>
<my:Uri x:Key="SoundFiles">file:///c:/Audio/HebrewDemo/Shalom.wav</my:Uri>
</UserControl.Resources>
I did this by pasting a local disk mp3 filename into source, then clicked on the "dot" by source and chose "Extract Value to Resource".
When I run, it tells me that "Uri" is not valid, and sure enough, in the Intellisense, I see other elements that start with "uri" but not just URI by itself.
In the real world I want to specify a dynamic mp3 file name. For example, I might have a database of foreign language words used for flashcards, I want to play a sound file on a URL. But I thought I would try to walk before running...
Now I'm trying this:
mediaElement1.Source = new Uri(
"http://HebrewResources.com/SoundFiles/Shalom.mp3",
UriKind.Absolute);
mediaElement1.Play();
The status bar in the FireFox browser indicates some data being transferred from the website. However, I never hear any sound. Could it just be an encoding issue? If it is not encoded properly, would I get an error?
Also, can I put the Uri statement in the load or make it run in the background, so the user can read the screen, at the same time the sound file is downloading? In other words, when he clicks the button to hear the soundfile, ideally it would already be preloaded for him. In this language-learning app, the user will see a word in a foreign language, and try to pronounce it himself, then he will click the "Play" button to hear the sound to check his results.
The first code which points to the local file won't work in a normal Silverlight application because of Silverlights "sanboxed" security model. Running a normal Silverlight application in your browser, you can't access local resources like you can if you were running an installed winforms/WPF application. Have a look at this video tutorial http://www.silverlight.net/learn/videos/all/local-file-access/, if you want to learn more about accessing local files using Silverlight.
In regards to your second piece of code, it should work, so quite possibly it's an encoding issue, and no unfortunately you often don't get any errors for things like that.
I created a sample app and pointed it at your mp3 file and it' wouldn't work, however a quick search for sample mp3s, lead me to another freely available (first hit). Using the code/url below, it works ok.
myMediaelement.Source = new Uri("http://www.robtowns.com/music/blind_willie.mp3", UriKind.Absolute);
In regards to the loading, it will start downloading the file when it hits the code that sets the source of the mediaelement. So if you set the source for the media element in your constructor or in your loaded event, it will automatically start downloading in the background. Then you just call myMediaelement.Play(); on the button click event.
If you find using Firefox a bit limited, when it comes to determine what and when something like external files or webservices are being loaded. There's a great free tool called Fiddler (http://www.fiddlertool.com/fiddler/version.asp) which will let you monitor those things very easily.
Good luck :)

redirect file to an url for streaming

I am setting up my hi-fi to stream music from my PC. The hi-fi can see all of the files in my music folder, but I want to be able to stream across the audio I am currently playing. The hi-fi however does not have support for this.
So I've found a .dll that wraps directsound and offers it streaming as a continuous mp3 file on my PC from localhost:8124
I want to make a file in my music folder that will point to this (i.e. audio.mp3). So when my hi-fi streams audio.mp3 and plays it, it will actually receive the contents from localhost:8124.
I've tried using symbolic links, but they don't seem to allow me to do this.
Finally I am running Windows 7.
Can I do this? and if so how?
You can't do that. You can't create something that looks like a file, but actually streams the content from some other location.
If your hi-fi doesn't support streaming, there's no solution. If it does support streaming, you'll need to find a way to support the streaming protocol it does handle.

Resources