Example #1
0
        public void mediaContentEqualsCheck()
        {
            string mediaString = "{\"original_length\":16280,\"original_mime_type\":\"video/mp4\",\"original_file_size\":730851,\"height\":360,\"width\":234,\"is_searchable\":false,\"mime_type\":\"video/mp4\",\"outlet\":\"videos\",\"original_file\":\"https://bireise-dev.anfema.com/protected_media/files/baaab979-37a5-4fc1-85aa-885ed2b96be9/a8Mo3xd_460sv_kTQmsWb.mp4\",\"file\":\"https://bireise-dev.anfema.com/protected_media/files/baaab979-37a5-4fc1-85aa-885ed2b96be9/a8Mo3xd_460sv.mp4.converted.mp4\",\"position\":0,\"checksum\":\"sha256:6c9f9e6adce81888ef1ebb9e7e9cf808411100df7bed3bfdcad3d55195ee8cbd\",\"type\":\"mediacontent\",\"file_size\":478799,\"name\":\"a8Mo3xd_460sv.mp4\",\"variation\":\"default\",\"length\":16280,\"original_height\":360,\"original_checksum\":\"sha256:243a7054cc4d3abd8cc574db293b026a075ab24a703a2c67bad28dfdeca242bf\",\"original_width\":234}";

            IonMediaContent media        = JsonConvert.DeserializeObject <IonMediaContent>(mediaString);
            string          mediaString2 = JsonConvert.SerializeObject(media);
            IonMediaContent media2       = JsonConvert.DeserializeObject <IonMediaContent>(mediaString2);

            Assert.AreEqual(media, media2);
        }
Example #2
0
        // Is used when the loading of the media didn't work
        private void mediaContent_MediaFailed(object sender, ExceptionRoutedEventArgs e)
        {
            MediaElement    me = (MediaElement)sender;
            IonMediaContent mc = (IonMediaContent)me.DataContext;

            // This is the fallback in case the media file is simply an image
            if (mc.mimeType.Contains("image/") && mc.mediaURI != null)
            {
                // Set image and set it visible
                Image image = getSibling <Image>(me, "mediaContentImage");
                image.Source     = new BitmapImage(mc.mediaURI);
                image.Visibility = Visibility.Visible;

                // Hide media element
                me.Visibility = Visibility.Collapsed;

                // Hide the play button
                getSibling <TextBlock>(me, "playButtonTextBlock").Visibility = Visibility.Collapsed;
            }

            //Debug.WriteLine("Media content of type " + mc.mime_type + " failed! " + me.Source);
        }