Why doesn't MediaElement work in Silverlight? - silverlight

When I run my Silverlight app, this code doesn't play a video at all:
<MediaElement
Source="winvideo-201DataGridPreview.wmv"
AutoPlay="True"
AudioStreamIndex="2"
Margin="10"
Height="200"
Width="200"/>
From all of the examples I can find of MediaElement, it seems to be the correct syntax, etc.
Is there anything I'm forgetting?

I had a similar problem. I added the wmv file as an existing object to my Silverlight project, and then on the properties of the wmv file, I set its build action to Resource. Once I did this it would play for me.

The referenced media files need to be in ClientBin folder. For Sliver-light 4.0 you may use not only .wmv but .mp4 format as well.

Edward, based on your XAML check: 1) that the WMV file is in the appropriate encoding format, 2) that the WMV file is located alongside where your XAP file is (I'd actually check this first).

It might be the case of unsupported mediafile.
These are supported (source: http://msdn.microsoft.com/en-us/library/cc189080(VS.95).aspx)
The MediaElement object supports the following formats. These encodings are supported regardless of the file name extension.
Video
WMV1: Windows Media Video 7
WMV2: Windows Media Video 8
WMV3: Windows Media Video 9
WMVA: Windows Media Video Advanced
Profile, non-VC-1
WMVC1: Windows Media Video Advanced
Profile, VC-1
Audio
WMA 7: Windows Media Audio 7
WMA 8: Windows Media Audio 8
WMA 9: Windows Media Audio 9
WMA 10: Windows Media Audio 10
MP3: ISO/MPEG Layer-3
Input: ISO/MPEG Layer-3 data stream
Channel configurations: mono, stereo
Sampling frequencies: 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, and 48 kHz
Bit rates: 8-320 kbps, variable bit rate
Limitations: "free format mode" (see ISO/IEC 11172-3, sub clause 2.4.2.3) is not supported.
On really simple (but a bit brute force) way to test if your video file is Silverlight compatible is to upload it to http://Silverlight streaming and it will tell you if it is ok or not.

I'm getting the same issue, I haven't found the right configuration that will reference the video file correctly. If I reference my video by source "vid1.wmv" and set it to content, it's packaged into the xap file but the video won't play.
As TimHeuer says, check the video file is in the same place as the .xap file.
If I copy the video file directly into the web project's ClientBin, it works.
That was the solution for me, but I'd really like to know how this should be done correctly.

This was very annoying but found that if you right click on your media file and properties and set it to "Content" build action it will be included in the XAP, then you reference it with /myPic.jpg/wmv or /Images/myPic.jpg/wmv (depending on the structure of your project and vid or pic obviously). Hope this helps

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.

Can I play mpga auido in ios?

I want to play one media stream by MPMoviePlayer, it can play h264 video but there is no sound output. I want to know is there any framework can handle the mpga audio ?
I can play it by VLC and got the media information as follow:
Apple's documentation states that MPMoviePlayerController can play any audio file that iOS supports natively.
But unfortunately for you, "mpga" format is not one of the audio file formats supported natively in iOS.
You're going to have to find a way to convert the "mpga" track to something iOS can use.
MPGAs files are basically mp3 but AvPlayer can't play them due to its file extension .
you can change file extention to mp3 easily and then player will work and can play the file.

MediaElement: Find out if file contains supported format

So the Silverlight MediaElement has certain supported media formats. I let my users upload files to a directory and have a MediaElement play these (via a SharePoint 2010 Media WebPart).
I could check the file extensions of the uploaded files and depending on that display them in the Media WebPart. The problem is that the file extensions given are: MP3, ASF, MP4, 3GP, WMV. However when I have an AVI file containing H264 encoded material it would also work, but the file extension would not tell me that.
Is there a way to check files for compatibility with the Silverlight MediaElement?
I don't believe their is but what is on the list of accepted formats.
Their is the option that you could reformat with a back end system to break the format down and re build it as an appropriate file.

How can we create ringtones in WP7 Mango using mp3 and wma already on the device?

How can I create a ringtone using existing mp3 and wma files already on the device in WP7 Mango?
Can I use MediaLibrary to get the music files on the device, and then use the ringtone task to create a new ringtone?
What are my options?
You can't do that because you don't have access to media streams for the content that is already stored on the phone outside your application. You either must have the files bundled with the application or download them individually from a web server.
Something to consider is written on my blog.
You can not do this using files on the phone. What you can do (with Mango), however, is edit files on your computer, ensuring that they are mp3 or WMA format, less than 29 seconds in length, and less than 1 MB in file size, change the Genre to Ringtone, and sync it to your phone through Zune Desktop. You can then use the file as a ringtone.

What is XAP file on Windows Phone 7?

I really want to know what the XAP file on Windows Phone 7 is; how important it is; and how I can create it. Could you help me?
XAP is the application package - it is the distributable unit that allows you to install the application on a device (or emulator). Basically, it is a ZIP file with a different extension. If you change XAP to ZIP, you'll be able to read its contents fairly easy.
The XAP file format was inherited from standard Silverlight, and since WP7 is built around the same fundamental core, the file format remained unchanged.
Here is a pretty good description of what it does (remember, that even though it talks about Silverlight, the same main idea applies to WP7):
http://beyondrelational.com/blogs/dinesh/archive/2010/08/18/what-is-xap-file.aspx
In addition to Dennis' excellent post, one other thing about a XAP file - it's a ZIP file - so if you want to look inside one, then just rename it to .zip and then open it using a normal ZIP browser (e.g Windows explorer)

Resources