In a previous post I mentioned I’m working on an app that plays videos. The app is pretty simple and fits a specific need I have. Once it’s in the Windows Store I’ll give the full details on it. In the meantime I want to share some tips and tricks I learn along the way that might help you with your app.
In the aforementioned previous post I showed you how I customized the appearance and behavior of the FileOpenPicker for picking only videos. Today’s tip has to do with how to get a bitmap image I can use in the UI of my Windows Store app from a file’s thumbnail. Essentially what I need to do in my app is have a small image of the video being played that I can display in an AppBar. Fortunately it’s pretty easy to do in a three step process:
- Get the thumbnail from a StorageFile
- Clone the stream of the thumbnail
- Create a new BitmapImage and set its source to the thumbnail’s cloned stream
Here’s the code:
Like I said, pretty easy! Hope it helps.