How do yo play a video with silverlight?
does Visual Studio come with a video player component build in? or do I need to make a video player?
As often is the case, it depends what you're requirements are.
You can use the media element which comes with Silverlight (msdn info here) , however, that means building everything from scratch, it does not come with a "player chrome", as in buttons and visual styles.
If you want a pre-built "player", there's at least a couple of options, the Expression Encoder tool (a free version is available), comes with a number of Silverlight players that you can freely use and modify if you wish. You find them under the "templates" section in expression encoder tool.
Another option is to use the "Microsoft Media Platform: Player Framework" (formerly known as Silverlight Media Framework (SMF)), which is a open source project which Microsoft is involved in, it comes with a fully featured "player" and is built on industry standards, you can find it at http://smf.codeplex.com.
Good luck!
In SL:
<MediaElement x:Name="MyVid"
Source="http://abc.xyz.com/MyVid.wmv"
Height="250"
Width="350"
AutoPlay="True"/>
Server-side needs to support MMS (RTSP protocol - streaming) or progressive downloads (MMS on the MediaElement's side takes care of both). Videos should conform to the SMPTE 421M video codec standard (VC-1).
Related
I am using web cam in WPF application. I am using Expression Encoder for video capture. for video capture I have created Job and its working properly. While I want to get picture with same resolution as video is. for this I am using ffmpeg to extract first frame from video. but quality of image is very low. the priority is that image quality should be best of attached web cam and resolution should be as much as video is.
Either we have any better option in Expression Encode for taking picture or kindly help me with any alternative.
You can have a look at this control:
The control provides the following functionalities:
Gets a list of available web camera devices on a system.
Displays a video stream from a web camera device.
Gets the current image being captured.
Requirements
The WPF version of the control is implemented using .NET Framework 4 Client Profile.
The control uses the VMR-9 renderer filter available since Windows XP SP2.
The control supports both x86 and x64 platform targets.
For some reason, accessing images from a web cam is far more complicated then it should be. While I have not used the Expression Encode application, I can provide you with two links to CodePlex, where you can find two different libraries that could help you to solve your problem. Please see the following pages:
WebCam Library for WinForm and WPF with C# and VB.NET
WPF MediaKit - For webcam, DVD and custom video support in WPF
Alternatively, if you're happy with using Expression Encode, then you could take a look at the following links:
Extracting still pictures from movie files, with C#
Extract frames from video files – The Code Project – Multimedia
I would recommend AForge.Net, it works flawless, free and licensed under LGPL v3 license, it also seems to work in both 32 and 64 bit.
The only drawback is that you need ~400 kb worth of dlls to get the webcam control.
Is it possible to only use a managed dynamic language such as javascript in a Silverlight application, with no server side compilation before deploying to the client? I'm looking for 0 server side compilation of any code here - would like the entire application to be 100% compiled/interpreted in the browser. I skimmed through the DLR specs but I didn't notice such an option.
Technically the answer is yes. Silverlight is a pure client side technology that runs a cut down, secure CLR in a plug in. The Silverlight API is accessible scripting languages including Javascript, F#, IronPython and IronRuby.
However, it is questionable whether you should progress because there doesn't seem to be any community or support around this. Furthermore, Silverlight is in support mode and you have to consider whether it is worthwhile investing your energy in such a dimly lit corner.
There are a few technology demonstrations by Jimmy Schementi here. Also check out the references in DLR Wikipedia entry. The old silverlight forums used to have an entire subforum dedicated to Javascript and Silverlight. This is now gone. Consider that as a warning if you decide to progress in this direction.
A few years back, there was an SDK that included a working IronPython and IronRuby with Silverlight, some demos and build scripts. Look for Chiron, which packages scripts and xaml into a single .xap (zip) file. This is in the DLR. There were some cool examples which demonstrated a python and ruby interpreter running in the client side in a Silverlight plugin.
Alternatively, you can develop most of your application in a typed language and then expose parts of it to javascript via a Javascript bridge. The MSDN has some short write up on how to do this.
EDIT: To better clarify the issue, I've included a scenario:
Scenario: There is an education institution that produces video tutorials. We were asked to provide a solution on how to protect the video files so as not to give access to the real video files to the users. The videos are published "offline" using DVD ROM.
Solution: We decided to embed the video files into the silverlight assembly and write a Silverlight OOB application that takes advantage of MediaElement control to play video content. This control accepts video resource of type Stream which makes it possible to use Application.GetResourceStream method to read the embedded resource as an stream and pass it to MediaElement.
Design: We need to write two applications:
One that accepts one or more video files from education institute operator and creates an assembly and embeds the video files into the assembly.
Another application that reads the contents of the newly-created assemblies and plays the video content using MediaElement control.
Problem:
How to generate a silverlight assembly and embed video resources to it "programmatically" using a C# windows app or Silverlight app? I wanted to use AssemblyBuilder class, but it does not contain Save method in silverlight.
Any help would be greatly appreciated.
Assuming you feel you need to embed your video in the way you described, rather than stream it, then you do not need to run the creation of modules on the Silverlight client.
Have the Silverlight app upload the Video to the matching Silverlight host
Now you have full access to the .Net stack and can create pretty much anything you need (including compiling projects or assemblies on the fly and using AssemblyBuilder).
If this does not cover your situation, please clarify the question further.
I'm interested in making a desktop application which I would want to use as a Desktop Manager. This kind-of goes to Desktop Enhancement Category. My requirements are:
Application has to be visually rich, with panels sliding,fading,wiping,rotating and etc.
It should also support flash playback. (swf, flv)
Animations/Transitions should run smoothly.
Lower CPU Usage.
My question is which is a better option to build this application. Microsoft's "WPF" or Adobe Flex(running in Adobe Air to run on desktop). And also respond as why it is better.
Be suspicious of anyone who will give you an answer like "Definately use xyz" to this question. There are pros and cons to both sides.
First, I think you might be confusing what WPF and Air are... WPF is a presentation layer on top of the .Net framework, where Air is a framework by itself. Apples and Oranges. If you want an analog to what Air is for the .Net stack, you probably want to look at Silverlight Out-Of-Browser, which is a much closer comparison to Air.
What is the difference, then, between WPF and Sliverlight OOB? Again, WPF sits on top of a very large .Net framework where Sliverlight OOB is a very light framework (in comparison) like air. It is the difference between a 200 MB download/install and a 12 MB download/install.
So, that being said, I think you should also ask what platforms this needs to run on. Silverlight OOB runs on Mac and Windows where WPF only runs on Windows. Air runs on Mac, Windows and Linux.
The next thing that I see is that you need to do SWF and FLV playback. This will be easier to achieve with Air, since it is native. You CAN do this with Silverlight OOB but you will find yourself rigging something up where you host an HTML control and run the flash movie inside the HTML control. It is a bit more clunky, but it will work.
Other than that, Air and SLOOB are very similar in features. It then comes down to your team and the expertise, IMO. If they are already familiar with the WPF/Silverlight, then a SLOOB app is well suited with minimal ramp-up. If your designers are more familiar with the Adobe suite of tools, then it might be easier to build a shiny app using Air.
In all, the decision between Air and Silverlight/WPF really comes down to preference. That is, once you get past any particular techincal limitations like the flash playback or OS support.
Hope this helps,
Brian
Is it possible to play a QuickTime Video in WPF? If yes, can anyone provide me the resources.
Quicktime is a tricky thing on Windows. The APIs pretty much don't exist for any language except C++. Here's some documentation from the Apple developer website; Quicktime Development For Windows. But I doubt this will be useful for your WPF development.
Another option is to use the Quicktime ActiveX control/COM object. Its essentially a built in player with minimal control.