Permalink
3f145d0 Dec 27, 2017
1 contributor

Users who have contributed to this file

37 lines (33 sloc) 1004 Bytes
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Octane.Xamarin.Forms.VideoPlayer;
namespace ChillPlayer.MarkupExtensions
{
/// <summary>
/// Loads an embedded resource from the currently executing assembly.
/// </summary>
[ContentProperty("Resource")]
public class VideoResourceExtension : IMarkupExtension
{
/// <summary>
/// The id of the EmbeddedResource to load.
/// </summary>
/// <value>
/// The source.
/// </value>
public string Resource { get; set; }
/// <summary>
/// Provides the value.
/// </summary>
/// <param name="serviceProvider">The service provider.</param>
/// <returns></returns>
public object ProvideValue(IServiceProvider serviceProvider)
{
if (Resource == null)
return null;
var videoSource = VideoSource.FromResource(Resource);
return videoSource;
}
}
}