I have a windows phone 8 app which is basically a media player, I upgraded it to 8.1 Silverlight, However since the upgrade I am no longer able to view the album art for albums downloaded from xbox music since the upgrade.
AlbumCollection albumsTemp;
albumsTemp = lib.Albums;
foreach (var currentAlbum in albumsTemp)
{
Debug.WriteLine("MusicGroup: LoadAlbums(): currentAlbum.HasArt = " + currentAlbum.HasArt);
}
This always returns false, whereas previously (on WP 8) it would be true and I could get the album art.
Does anyone know how to access the album art?
You could use the Music Properties class in order to access the Album details which also includes the Album Art:
Sample: Get Album info in Windows Phone 8.1
Reference: StorageItemContentProperties.GetMusicPropertiesAsync
Related
Someday I found that all my WPF applications failed to drag outside of the windows and I cannot resize any windows with real-time preview.
My question is why this happens and how can I solve this?
You can view the animation image showing below:
You can notice that when my cursor is outside the window, the resizing immediately stops and the window keep the size when the cursor first leaving the window there. If the cursor reenters the window area and the window resizing resumes.
Not only all the WPF applications that are written by me, but also the other WPF applications reproduces:
Visual Studio 2017/2019
Snoop
ScreenToGif
Etc.
Non-WPF applications behave correctly.
This phenomenon happens several months ago since my system version was Windows 10 (1809) and now my system version is Windows 10 (1903) and this issue stands still. WPF application embedded from .NET Framework 3.5/4.5/4.8 and .NET Core 3.0.
Update1: I just cleaned all my drives and reinstalled my Windows 10 Professional (1903, Customer version) with some core applications, the issue still exists. The core applications are Chrome, PalmInput IME, iTunes.
Update2: I've written a WPF application handle the window messages. I find that the 49757 message will stop receiving when I'm resizing window outside of it. The message behaves normally on my friend's system.
Update:
As pointed out by members of the WPF team the recommended way of disabling stylus and touch support in WPF is by using the Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport setting in App.config like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport=true" />
</runtime>
</configuration>
Also note that this is not a solution, rather a work around, that might not be a good fit for all scenarios.
Original:
Markus Eisenstöck found a work around for this issue. By disabling the tablet support in WPF you will experience the expected behavior. I have tested and it works on my machine (Windows 10 version 1903 & .NET Framework 4.6.2):
public static void DisableWpfTabletSupport()
{
// Get a collection of the tablet devices for this window.
TabletDeviceCollection devices = System.Windows.Input.Tablet.TabletDevices;
if (devices.Count > 0)
{
// Get the Type of InputManager.
Type inputManagerType = typeof(System.Windows.Input.InputManager);
// Call the StylusLogic method on the InputManager.Current instance.
object stylusLogic = inputManagerType.InvokeMember("StylusLogic",
BindingFlags.GetProperty | BindingFlags.Instance |
BindingFlags.NonPublic,
null, InputManager.Current, null);
if (stylusLogic != null)
{
// Get the type of the stylusLogic returned
// from the call to StylusLogic.
Type stylusLogicType = stylusLogic.GetType();
// Loop until there are no more devices to remove.
while (devices.Count > 0)
{
// Remove the first tablet device in the devices collection.
stylusLogicType.InvokeMember("OnTabletRemoved",
BindingFlags.InvokeMethod |
BindingFlags.Instance | BindingFlags.NonPublic,
null, stylusLogic, new object[] { (uint)0 });
}
}
}
}
I have a Windows Phone 8 app that I recently upgraded to 8.1 Silverlight. I'd like to use the new tile templates. Right now I have a ScheduledTaskAgent that uses ShellTile.
In order to use the new live tiles I changed the notification service to WNS in my WMAppManifest.xml. I removed the code to register the old background task and added this code instead:
var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();
if (backgroundAccessStatus == BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity ||
backgroundAccessStatus == BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity)
{
foreach (var task in BackgroundTaskRegistration.AllTasks)
{
if (task.Value.Name == "LiveTileBackgroundTask")
{
task.Value.Unregister(true);
}
}
BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder();
taskBuilder.Name = "LiveTileBackgroundTask";
taskBuilder.TaskEntryPoint = "BackgroundTasks.LiveTileBackgroundTask";
taskBuilder.SetTrigger(new TimeTrigger(15, false));
var registration = taskBuilder.Register();
}
I created a Windows Phone 8.1 Windows Runtime Component called BackgroundTasks that contains a BackgroundTask called LiveTileBackgroundTask:
public sealed class LiveTileBackgroundTask : IBackgroundTask
{
public void Run(IBackgroundTaskInstance taskInstance)
{
BackgroundTaskDeferral deferral = taskInstance.GetDeferral();
const string xml = "<tile>"
+ "<visual>"
+ "<binding template='TileWideText01'>"
+ "<text id='1'>Text Field 1 (larger text)</text>"
+ "<text id='2'>Text Field 2</text>"
+ "<text id='3'>Text Field 3</text>"
+ "<text id='4'>Text Field 4</text>"
+ "<text id='5'>Text Field 5</text>"
+ "</binding> "
+ "</visual>"
+"</tile>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
TileNotification tileNotification = new TileNotification(doc);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
deferral.Complete();
}
}
I added a reference to this assembly in my Windows Phone project.
I also added a Background task declaration in my Package.appxmanifest that has BackgroundTasks.LiveTileBackgroundTask as an Entry point. I selected Timer and System event as supported task types.
When I run the app though, nothing happens. No live tile appears. I ran through the background task and everything goes well without any exceptions.
You say "No live tile appears". The code you've posted does not create a live tile - it just updates one. You have to manually pin it - the primary tile cannot be pinned through code.
If that's not the problem, maybe you're not looking at the wide tile? This template is for a wide tile, so the square tile won't be updated by this. I'd suggest using the NotificationsExtensions library. It was originally for Windows Store apps, but I think it would work for WP as well. (I've used it, but just for a test, not for real, so there may be issues.) It allows you to easily specify the template and params for both wide and square tiles.
And finally, to have a wide tile, you have to manually edit the Package.appxmanifest file. You must add the Wide310x150Logo attribute to the DefaultTile element.
That's all I can think of. Hope it helps.
Continuous background execution is not supported for Silverlight 8.1
apps
Windows Phone 8 apps can continue to run in the background after the
user navigates away from the app under certain conditions. This
feature is not available for Silverlight 8.1 apps. If you need this
feature, you should continue to use a Windows Phone 8 app. For more
information, see Running location-tracking apps in the background for
Windows Phone 8.
Platform compatibility and breaking changes for Windows Phone Silverlight 8.1 apps
Windows Phone 8.1 Windows Runtime Component can only be used with Windows Phone 8.1 Runtime(Store) app
I want my application to play (.m3u8) Live Streaming , i found this example
http://archive.msdn.microsoft.com/SmoothStreaming/Release/ProjectReleases.aspx?ReleaseId=3867
It works with other links but if i try my .m3u8 link it does not work.
Is there a specific way to play that type of streaming in windows phone?
public MainPage()
{
InitializeComponent();
SupportedOrientations = SupportedPageOrientation.Landscape;
Loaded += new RoutedEventHandler(MainPage_Loaded);
phoneApplicationPage.ManipulationStarted += new EventHandler<ManipulationStartedEventArgs>(phoneApplicationPage_ManipulationStarted);
phoneApplicationPage.ManipulationCompleted += new EventHandler<ManipulationCompletedEventArgs>(phoneApplicationPage_ManipulationCompleted);
seekbar.MouseLeftButtonUp += new MouseButtonEventHandler(seekbar_MouseLeftButtonUp);
List<Content> Contents = new List<Content>();
Contents.Add(new Content("Media One", new Uri("http://fl1.viastreaming.net/iqraatv2/livestream/playlist.m3u8")));
Contents.Add(new Content("Media Two", new Uri("http://Media_Two.ism/manifest")));
Contents.Add(new Content("Media Three", new Uri("http://Media_Three.ism/manifest")));
Contents.Add(new Content("Media Four", new Uri("http://Media_Four.ism/manifest")));
comboBoxUrls.ItemsSource = Contents;
comboBoxUrls.SelectedIndex = 0;
comboBoxUrls.SelectionChanged += new SelectionChangedEventHandler(comboBoxUrls_SelectionChanged);
}
It is possible take a look at this project from CodePlex it is working with HLS (m3u8) for both Windows Phone 7 and Windows Phone 8!
Windows Phone Streaming Media
This worked perfectly. Playing HLS (m3u8 playlist) on Windows Phone 8.1
Download the player framework, consume the following DLL's:
Add the player to your xaml:
xmlns:mmppf="using:Microsoft.PlayerFramework"
xmlns:smmedia="using:SM.Media.MediaPlayer"
<mmppf:MediaPlayer IsFullScreenVisible="True" IsFullScreenEnabled="True" IsFullScreen="False" CurrentStateChanged="mPlayer_CurrentStateChanged" x:Name="mPlayer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsFastForwardEnabled="False" IsInfoEnabled="False" IsLive="True" IsMoreEnabled="False" IsRewindEnabled="False" IsRightTapEnabled="False" IsScrubbingEnabled="False" IsSeekEnabled="False" IsSkipBackEnabled="False" IsSkipAheadEnabled="False" IsReplayEnabled="False" IsTimelineVisible="False" IsTimeElapsedVisible="False" IsTimeRemainingVisible="False" RequestedTheme="Dark">
<mmppf:MediaPlayer.Plugins>
<smmedia:StreamingMediaPlugin />
</mmppf:MediaPlayer.Plugins>
</mmppf:MediaPlayer>
Then set your stream VIA code - or XAML if the URL never changes.
This blog post suggests that it might be possible to play YouTube videos with the Silverlight MediaEelement directly.
<MediaElement HorizontalAlignment="Left"
VerticalAlignment="Top"
Source="http://www.youtube.com/get_video?
video_id=8yuIw_0ejLs&t=vjVQa1PpcFPrX3tFoahhu4DbniDIqTLkwybdm8xuCt8%3D&fmt=22"/>
I was wondering if this holds true for the Windows Phone 7. I have an application that is based on playing videos hosted on YouTube, and it would be nice to be able to have more control over the video experience other than just launching the browser with the YouTube video URL.
Unless you have a direct link to video content, you cannot display YouTube videos on Windows Phone 7. As far as I know, get_video is no longer available for public access.
Quoting from the Windows Phone Developer FAQ
How can I play youtube videos in my app?
Use the WebBrowserTask and open the target URL in the browser; if the youtube app is installed, it will play, if not installed, it will prompt the user to install and then play.
For everyone else still curious the problem to overcome is getting a direct link to the video which does require a small hack but it's very reliable and easy to do. Firstly you need the video id so you can get the youtube url which you can use the youtube api for. Then do something like this. I pretty much converted a userscript to silverlight.
WebClient client = new WebClient();
string url = "http://www.youtube.com/watch?v=HLQqOpILDcI";
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(ClientDownloadStringCompleted);
client.DownloadStringAsync(new Uri(url, UriKind.Absolute));
the next bit looks bad.
private void ClientDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
rx = new Regex("(?<=url_encoded_fmt_stream_map=)([^(\\\\)]*)(?=\\\\)", RegexOptions.IgnoreCase);
match = rx.Matches(flashvars);
string video_format = match[0].ToString();
string sep1="%2C";
string sep2="%26";
string sep3="%3D";
string link = "";
string[] videoFormatsGroup = Regex.Split(video_format, sep1);
for (var i=0;i<videoFormatsGroup.Length;i++){
string[] videoFormatsElem = Regex.Split(videoFormatsGroup[i], sep2);
if (videoFormatsElem.Length<5) continue;
string[] partialResult1 = Regex.Split(videoFormatsElem[0], sep3);
if (partialResult1.Length<2) continue;
string url = partialResult1[1];
url = HttpUtility.UrlDecode(HttpUtility.UrlDecode(url));
string[] partialResult2 = Regex.Split(videoFormatsElem[4], sep3);
if (partialResult2.Length<2) continue;
int itag = Convert.ToInt32(partialResult2[1]);
if (itag == 18){
link = url;
}
}
}
the last bit itag==18 selects the quality according to this
{'5':'FLV 240p','18':'MP4 360p','22':'MP4 720p (HD)','34':'FLV 360p','35':'FLV 480p','37':'MP4 1080p (HD)','38':'MP4 4K (HD)','43':'WebM 360p','44':'WebM 480p','45':'WebM 720p (HD)','46':'WebM 1080p (HD)'};
now you can do whatever you want with the link like open it with mediaplayerlauncher or mediaelement. personally i'd love to download it to isolated storage and play it at the same time but at the moment that seems easier said than done. thanks for your time sorry for the long post.
I am sure you can adjust it for Windows Phone http://www.codeproject.com/KB/WPF/YouViewer.aspx
This question already has an answer here:
Launch Silverlight Out-of-Browser from browser post-installation
(1 answer)
Closed 2 years ago.
I'm planning to build a download manager application and would like to be able to launch the application when a user clicks a button the site. The application would obviously already need to be installed on the client machine.
There are a few reasons why this needs to be written using Silverlight, but they're not really relevant to the question. I only mention it so that people don't suggest that I use another technology.
Doing a bit of a mash up from two other posts [1] and [2].
But of course this will only work for Windows not Mac. There you will have to fallback to the #michael-s-scherotter style solution.
private void Button_Click(object sender, RoutedEventArgs e)
{
if (Application.Current.HasElevatedPermissions && System.Windows.Interop.ComAutomationFactory.IsAvailable)
{
string run = "\""%ProgramFiles%\\Microsoft Silverlight\\sllauncher.exe"\" /emulate:"Silverface.xap" /origin:\"http://www.silverlight.net/content/samples/apps/facebookclient/ClientBin/Silverface.xap\" /overwrite";
dynamic cmd = ComAutomationFactory.CreateObject("WScript.Shell");
cmd.Run(run, 1, true);
}
}
Yes. Here is an example:
http://www.silverlight.net/content/samples/apps/facebookclient/sfcquickinstall.aspx
I found a trick that launches the installed silverlight OOB from the silverlight app in-browser. Both applications should be singed and have the elevated trust.
When a user installs the silverlight OOB App first time, retrive the path and argument values from the shortcut file of the OOB app on desktop. (ref: How I can use Shell32.dll in Silverlight OOB) If you know the the path and argument values, you can launch the OOB app using Com Object.
Send the retrive the path and argument values to the silverlight App in-browser. (ref: http://msdn.microsoft.com/en-us/library/dd833063(v=vs.95).aspx)
Store the path and argument values in a cookie.
Now, the silverlight app in-browser is able to launch the silverlight OOB using the path and argument values in the cookie.
using (dynamic shell = AutomationFactory.CreateObject("WScript.Shell"))
{
shell.Run(launchPath);
}
I hope this trick is useful to you :)
It is possible if you agree to install the app each time the user clicks on it.
You also should set the app to require elevated trust in its OOB settings.
Just uninstall the app on startup (for example, in main window constructor):
if (Application.Current.HasElevatedPermissions && Application.Current.InstallState == InstallState.Installed)
{
string launcherPath = string.Empty;
using (dynamic shell = AutomationFactory.CreateObject("Shell.Application"))
{
string launcher64 = #"C:\Program Files (x86)\Microsoft Silverlight";
string launcher32 = #"C:\Program Files\Microsoft Silverlight";
dynamic folder64 = shell.NameSpace(launcher64);
if (folder64 != null)
{
launcherPath = launcher64;
}
else
{
dynamic folder32 = shell.NameSpace(launcher32);
if (folder32 != null)
{
launcherPath = launcher32;
}
}
}
using (dynamic shell = AutomationFactory.CreateObject("WScript.Shell"))
{
var origin = Application.Current.Host.Source.OriginalString;
var launchCmd = string.Format(#"""{0}\sllauncher.exe"" /uninstall /origin:""{1}""", launcherPath, origin);
shell.Run(launchCmd);
}
}
(the code for uninstall was taken from this post: http://www.wintellect.com/blogs/sloscialo/programmatically-uninstalling-silverlight-out-of-browser-application)