diff --git a/Directory.build.props b/Directory.build.props
index a6e5fa91..e725cbca 100644
--- a/Directory.build.props
+++ b/Directory.build.props
@@ -14,7 +14,7 @@
git
$(AssemblyName) ($(TargetFramework))
en
- 0.8.0
+ 0.8.1
latest
$(NoWarn);1591;1701;1702;1705;VSX1000;NU1603
diff --git a/MediaManager/IMediaManager.cs b/MediaManager/IMediaManager.cs
index ee37d4e3..66535af0 100644
--- a/MediaManager/IMediaManager.cs
+++ b/MediaManager/IMediaManager.cs
@@ -57,7 +57,14 @@ public interface IMediaManager : IPlaybackManager, IDisposable
///
///
///
- Task Play(string resourceName, Assembly assembly);
+ Task PlayFromAssembly(string resourceName, Assembly assembly = null);
+
+ ///
+ /// Plays a native resource
+ ///
+ ///
+ ///
+ Task PlayFromResource(string resourceName);
///
/// Plays a list of media items
diff --git a/MediaManager/Media/IMediaExtractor.cs b/MediaManager/Media/IMediaExtractor.cs
index 1996aa73..b877dc84 100644
--- a/MediaManager/Media/IMediaExtractor.cs
+++ b/MediaManager/Media/IMediaExtractor.cs
@@ -9,11 +9,16 @@ namespace MediaManager.Media
public interface IMediaExtractor
{
IList RemotePrefixes { get; }
+
IList FilePrefixes { get; }
+ IList ResourcePrefixes { get; }
+
Task CreateMediaItem(string url);
- Task CreateMediaItem(string resourceName, Assembly assembly);
+ Task CreateMediaItemFromAssembly(string resourceName, Assembly assembly = null);
+
+ Task CreateMediaItemFromResource(string resourceName);
Task CreateMediaItem(FileInfo file);
diff --git a/MediaManager/Media/MediaExtractorBase.cs b/MediaManager/Media/MediaExtractorBase.cs
index 74437add..f37eaeb8 100644
--- a/MediaManager/Media/MediaExtractorBase.cs
+++ b/MediaManager/Media/MediaExtractorBase.cs
@@ -11,13 +11,30 @@ public abstract class MediaExtractorBase : IMediaExtractor
{
protected Dictionary RequestHeaders => CrossMediaManager.Current.RequestHeaders;
+ public IList RemotePrefixes { get; } = new List() {
+ "http",
+ "udp",
+ "rtp"
+ };
+
+ public IList FilePrefixes { get; } = new List() {
+ "file",
+ "/",
+ "ms-appx",
+ "ms-appdata"
+ };
+
+ public IList ResourcePrefixes { get; } = new List() {
+ "android.resource"
+ };
+
public virtual Task CreateMediaItem(string url)
{
var mediaItem = new MediaItem(url);
return UpdateMediaItem(mediaItem);
}
- public virtual async Task CreateMediaItem(string resourceName, Assembly assembly)
+ public virtual async Task CreateMediaItemFromAssembly(string resourceName, Assembly assembly = null)
{
if (assembly == null)
{
@@ -37,21 +54,7 @@ public virtual async Task CreateMediaItem(string resourceName, Assem
using (var stream = assembly.GetManifestResourceStream(resourcePaths.Single()))
{
- if (stream != null)
- {
- var tempDirectory = Path.Combine(Path.GetTempPath(), "EmbeddedResources");
- path = Path.Combine(tempDirectory, resourceName);
-
- if (!Directory.Exists(tempDirectory))
- {
- Directory.CreateDirectory(tempDirectory);
- }
-
- using (var tempFile = File.Create(path))
- {
- await stream.CopyToAsync(tempFile).ConfigureAwait(false);
- }
- }
+ path = await CopyResourceStreamToFile(stream, "EmbeddedResources", resourceName).ConfigureAwait(false);
}
var mediaItem = new MediaItem(path);
@@ -59,6 +62,15 @@ public virtual async Task CreateMediaItem(string resourceName, Assem
return await UpdateMediaItem(mediaItem).ConfigureAwait(false);
}
+ public virtual async Task CreateMediaItemFromResource(string resourceName)
+ {
+ var path = await GetResourcePath(resourceName).ConfigureAwait(false);
+
+ var mediaItem = new MediaItem(path);
+ mediaItem.MediaLocation = MediaLocation.Resource;
+ return await UpdateMediaItem(mediaItem).ConfigureAwait(false);
+ }
+
public virtual Task CreateMediaItem(FileInfo file)
{
return CreateMediaItem(file.FullName);
@@ -79,23 +91,32 @@ public virtual async Task UpdateMediaItem(IMediaItem mediaItem)
return mediaItem;
}
- public abstract Task