Yo. Some of you might already know but Xamarin Apps are booting pretty slow and the delay occurs before any line of code is executed - at least i figured that out with some breakpoints.
So i want to cover that up using a Splashscreen. But since Xamarin is for multiple platforms i'd like to... welll... use cross platform code.
The most important part is: i do NOT want to cover my code delay. I want to App to NOT open with a white blank screen like it currently does, but e.g. with an image or some animation or such stuff.
and yes i already googled a little but everything i found seemed to be android specific or iphone stuff, or it just takes affect after the system boots.
There is no cross-platform way to do that yet. (Answering in 2017/Dec)
You'll need to make it for each platform.
Android: https://developer.xamarin.com/guides/android/user_interface/splash-screen/
iOS: https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/
Related
I wanted to revisit this question from before I first asked it. I'm developing a completely new version of my application and I cannot find any media player available cross-platform from the shared code in Xamarin.Forms so I'm stuck with using MediaElement as its the only one that provides the functionality of using embedded resources for video files. Unlike the other players out there all use API and URI to play videos from the internet which is not what I need.
After numerous testing on 2 different platforms, this app is for Android and iOS, I now can tell confidently that the flickering is only happening on Android devices and not iOS -> iPhones or iPads.
I wonder if there is any solution to pre-load the source file to the MediaPlayer which is what is under the hood for Android using MediaElement.
There are a few solutions that I've come up with but am not happy with.
1: Have an identical first frame image of the video and overlay it over the screen for 200 - 400 milliseconds and make it disappear. The problem with that is it is not easily scalable which I require as my app requires a large number of videos and getting the first frame of approx 120+ videos and having them all as assets are just not necessary.
2: Take a screenshot of the previous screen and display it over the video screen and make it disappear after 200 - 400 milliseconds and then make it disappear. The problem with this actual user experience becomes weird because you constantly see the previous screen and you see it just disappear even tho you've just come to a new page and you can definitely tell that you've moved pages.
In conclusion, I don't really know if this is a problem possible to solve by a user of the package or if requires someone who is in depth of understanding the package to fix this. This could also be a problem in Android side which doesn't load videos efficiently and this is causing problems in loading videos for Android platform apps
Many Thanks in Advance.
I'm developing a Windows 10 Universal app (UWP).
Is it possible to set application as TopMost (always on top)? Like WPF or Winforms (TopMost property).
Thanks
A feature called CompactOverlay mode was added in the Creators Update that supports this type of functionality. When an app window enters compact overlay mode it’ll be shown above other windows so it won’t get blocked. This allows users to continue to keep an eye on your app's content even when they are working with something else. The canonical example of an app taking advantage of this feature is a media player or a video chat app.
A blog post describing the feature can be found here
https://blogs.msdn.microsoft.com/universal-windows-app-model/2017/02/11/compactoverlay-mode-aka-picture-in-picture/
Short answer is no, there is no way as of today to make the application modal.
There is a petition going around asking for this functionality, which was requested last December but given the amount of votes it got (35 at the time this answer was written), it doesn't look like it will be taken into consideration anytime soon.
As mentioned in the comments, this functionality would be PC only so even if it was added, my assumption would be that it wouldn't work outside of the PC mode (so no tablet, mobile or surface family device support).
It's not possible UWP apps have some restrictions compared with WPF of Win32 apps(classic apps).
With uwp apps you need enable some capabilities to do something special in your app as you can see in the link uwp apps need ask for permission or they can't access or modify files directly.
https://msdn.microsoft.com/en-us/library/windows/apps/mt270968.aspx
Best Regards
I would like to create an app which would pop-up fullscreen when user is not interacting with the device; the first tap would then close it. So it's exactly like a screensaver. It should "run" 24/7. Display should always be lit. Battery is of no concern.
I've already done this on android, but my WP skills are lacking and complete research would take me at least a couple of days, so I'm asking any WP gurus out there:
can the same functionality (screensaver) be achieved on the Windows Phone 8.1 platform?
If so, which are the basics that should be covered (programming-wise)?
Edit:
The only solution I have at this moment is changing the LockScreen background on a 30minute interval.
I'm still not sure whate happens in 2 weeks as some info suggests that the registered task will expire. Not to mention that LockScreen is shown only a few seconds.
Edit 2:
Subquestion: is there a way to keep LockScreen shown at all times (while charging)? Or maybe lauch lock screen from code?
Windows Phone doesn't usually allow apps to pop up on their own. Exceptions are made for specific usecases such as voip. There is also no way for an app that isn't running in the foreground to realise that the user hasn't interacted with the screen for any number of minutes.
Therefore your only option is to use the inbuilt lockscreen functionality.
I am a C# developer working on conversions to Mono Android. These conversions work perfectly, except for when the phone times out or blacks out and the user touches the screen again.... The game is lost.
What is the simplest way of dealing with this? I have heard it referred to as the life cycle, and found many brief descriptions of this cycle without explanations of how to implement it with real examples, and especially, how to implement it with XNA conversions.
My first solution would be to have a 'Pause' method in the XNA game, and run that method for the 'onPause' of the Android. However there may be simpler ways of dealing with this, as I have heard there are simple Mono Android settings to pick that will deal with time outs and phone calls automatically.
What I ask is.. How do I make my XnA conversion continue to run through a phone call, screen timeouts, etc?
Might I ask if you are using MonoGame or simply the AndroidGameView that comes with Mono for Android?
If you are using AndroidGameView, I suggest you follow the convention of reloading the textures manually in OnLoad() as per the textured cube sample.
When using MonoGame, if you load textures via ContentManager.Load<Texture2D>(), reloading is handled for you. Textures loaded using Texture2D.FromStream must be manually reloaded in the GraphicsDevice.DeviceReset event.
As Andrew Russell pointed out, ExEn has the advantage that it doesn't need to reload the textures on every resume. However, it is still necessary (or good practice at least) to support reloading graphics resources on Android. On many devices your game will not be able to gracefully recover from switching away and back without it. ExEn currently has no support for reloading textures.
Xamarin are currently working on fixing a bug in AndroidGameView that will allow it to correctly resume where the device supports it. Once released, this should flow through to MonoGame.
Aside from reloading textures and other graphics resources, handling of the life cycle should be fairly trivial. MonoGame has not yet implemented the complete Windows Phone life cycle (ie the tombstone and rehydrate), but in my experience, it's not necessary. You can use the Game.Activated and Game.Deactivated events for things like showing the pause screen when resuming in-game.
I've written a WPF application (in Visual C# 2010 Express) that has 2 windows. The 1st has a various buttons, the other displays video using the MediaElement control. When a button is pressed, a video associated with it is played or stopped if it's already playing.
On my development machine (Windows 7, good graphics card, lots of memory etc), this runs fine. The only problem I've encountered is that when attached to the debugger it is very unstable but when run normally these issues go away.
Unfortunately when run on a much less powerful XP machine the videos run at 1-2fps. This is despite the fact that the videos run fine in Windows Media Player.
There seem to quite a lot of reports of poor performance for the MediaElement control (not to mention inconsistencies in what it can play) so I decided to look at some alternatives.
I tried a free library call WPF MediaKit (http://wpfmediakit.codeplex.com) that I thought might have some effect, however while I've got it to work on an XP machine, it resolutely refuses to display videos on my development machine despite using exactly the same code. I'm still hoping I can this to work but I'm not confident it will help given it's still using the MediaElement control behind the scenes.
I then tried using wmp.dll COM control (Windows forms rather than WPF) and even with the simplest app (new Windows Form project, WMP control added to form, and 1 line of code to set the URL on load) I get odd behaviour. With the debugger attached, it works across multiple monitors, but sometimes when it starts playing, it just repeatedly stutters over the 1st few frames and the only way to break it out of this seems to be to move it to the other monitor. If I'm not using the debugger, I don't seem to get the stutter issue but the video is only displayed on the main monitor, as soon as I move the window to the secondary monitor, it goes black.
So my question is has anyone experienced anything like the above and/or have a decent solution to it? It would be especially nice to find something that works consistently with and without the debugger attached!
Have you tried this library?
http://directshownet.sourceforge.net/about.html
There's also this .NET interface to VideoLAN media player, but that introduces a dependency to VLC:
http://wiki.videolan.org/.Net_Interface_to_VLC
WPF MediaKit does not use MediaElement behind the scenes, but instead uses the D3DImage interop class to provide high performance video to WPF.
WPF in XP has always been a hit-or-miss in terms of performance. You might want to take a look at the rendering tier to ensure WPF is fully hardware accelerating. Also make sure you have the newest video drivers available and that the GPU is capable.
-Jer