Archive for June, 2010

Silverlight Smooth Streaming plugin for WordPress

10 commentaires
Get Microsoft Silverlight

I put online a new plugin produced by Regart.net. It is a smooth streaming video player also capable of playing a standard video format wmv, mov or mp4 (when the video is encoded in H264). You will still need to host the video on IIS server if you want to enjoy the smooth streaming. The setup is relatively simple because we provide an administration window in WordPress. It has a preview of the player, you can change the color, the url of video, AutoPlay, size and background color of the player. It warns you when the video is not hosted on your server, about security constraints you may encounter (crossdomain.xml clientaccesspolicy.xml necessary and configured).

I realized the Silverlight side but I did not use the player SMF published by Microsoft. I preferred to use the library named SLExtensions designed by the company UCAYA. UCAYA is specialized in the design of this type of player. In the past, Ucaya has made the players of "Tour de France", "Rolland Garros", "France Television" and so on. What are the benefits you will ask ? It's simple. First of all, the features provided by the library are ultra complete. In addition, it offers the possibility of a Full MVVM conception, the interface is entirely Designable (much better than skinnable). Finally, its design is quite thin as it can instantiate a MediaElement or equivalent for smooth streaming according to the type of URL you provide : ISML ism and for smooth streaming wmv, mov, mp4 (H264) for standard videos. It is therefore possible to make a player at the card and avoid the arsenal of the library SMF provided by Microsoft.

Yet another 3D Lite Engine

Aucun commentaire

I will put online during the summer a first release of the library Tweened. It contains components, behaviors, a Tween wrapper (facilitating the creation of animation by code) and a mini 3D engine very simple to use. Here is a concrete example that can be downloaded here :

Install Microsoft Silverlight

I made this engine primarily for personal needs and to remind me math projective. Reinventing the wheel a some times can be good. The idea is mainly to provide a dll under 40kb, which allows conception of 3D interfaces. This will be useful for designers across Blend or Visual Studio using C #. It will contain in a short time all the basic functions wich are really useful and we do not currently have when using Blend: 3D Camera, 3D Container, 3D scene, detection of normal and smart z sorting (smart and more efficient than currently proposed in Blend) . I added a utility class to facilitate the use of mathematical projective (in progress).

The library contains :

1. A container typed Scene3D (inherited from Panel).
All objects wich are contained within get their projection property locked. Instead of use it, they can use attached dependency properties :

* Scene3D.LocalOffsetX
* Scene3D.LocalOffsetY
* Scene3D.LocalOffsetZ
* Scene3D.GlobalOffsetX
* Scene3D.GlobalOffsetY
* Scene3D.GlobalOffsetZ
* Scene3D.RotationX
* Scene3D.RotationY
* Scene3D.RotationZ

They are associated with an instance of type Element3D. This is recoverable (StartUp event when the 3d scene is broadcast) with an extension method added to instances of UIElement (GetElement3D).
2. A camera linked to the container Scene3D. It offers the following properties:
* FieldOfView
* NearPlane
* FarPlane
* Vanishing Point (XVanishingPoint, YVanishingPoint)
* Displacement (OffsetXCamera, OffsetYCamera, OffsetZCamera)
* Rotation (RotateXCamera, RotateYCamera, RotateZCamera)

Detecting the change of direction of normal (Backface culling) and the scalar product via events NormalDirectionChanged and DotProductChanged. These events are broadcast by instances of Element3D.

I am currently finishing a sorting algorithm depths. This engine should be fairly optimized because its rendering does not rely on a DispatcherTimer. Well, it is rather rendering pipeline optimized because it is not recursive by default. When only one object is changed, it invokes an internal method RenderElement. Conversely, when the scene or the camera is changed, it becomes recursive and updates all objects in the scene ... See you soon for the final release of the library tweened ...

Design Time Resources in Blend 4

Aucun commentaire

Blend 4 offers new features and one of them is rather obscure at first. Now, it is possible in Expression Blend to create resources unique to the design time (at the time of conception in Blend or Visual Studio). The problem is rather trivial, it is often necessary to allocate graphics resources that are defined at runtime. In the workspace of Visual Studio or Blend, they are not resolved as they are defined at runtime. This causes access errors and some display problems. Blend 4 can now solve this problem but the manner of proceeding is not very obvious. The goal is to create a design time resource dictionary containing a resource or multiple resources that you will only use the design time. The first thing to do is create a project and a resource contained in a resource dictionary. A gradient or SolidColorBrush will do the trick (see below).

Then, delete the link defined in App.xaml. Resources are now inaccessible and you get access errors. It does not matter, you have to go through this step. Save the project and then open it again in Blend 4, you get a nice dialog box telling you whether you want to create a dictionary used in design time (see below).

Finally, create the resource via C #, it will be used by Silverlight at runtime.

In the end you get two different visual result. The first concerns the design time, the second is the visual displayed at runtime using the resource instantiated during initialization:) So, the designer is completely autonomous. Ultimately, this process is not very orthodox but it is very useful. The principle is not based on anything other than a conditional compilation, generated at the project level (. Csproj). The following code:

<Page Include="Properties\DesignTimeResources.xaml">
 <Generator>MSBuild:Compile</Generator>
 <SubType>Designer</SubType>
 </Page>

has been replaced by this one :

<Page Include="Properties\DesignTimeResources.xaml"
Condition="'$(DesignTime)'=='true'
OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)')
AND '$(BuildingInsideVisualStudio)'!='true'
AND '$(BuildingInsideExpressionBlend)'!='true')">
 <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
 <ContainsDesignTimeResources>true</ContainsDesignTimeResources>
 </Page>