Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:05:30+00:00 2026-06-13T06:05:30+00:00

I have function for searching videos in folder. For every video file in that

  • 0

I have function for searching videos in folder. For every video file in that folder I am adding MediaElement and starts playing. When I have cca 10 videos it was all right. Then I added some videos, change view element from grid to canvas (because of performance) and now some mediaelement didn´t show (there is blank place where they should be). It is not one and same video. Mostly these happens to videos that are later procesing but not always. Does anyone know where could be problem? I think it is not problem with performance because the rest of videos are playing all right and application working fine. So is there some limitations? Or what I am doing wrong? Testing videos are .wmv and low quality (320×240).

View:

<Canvas x:Name="mainCanvas">
            <ScrollViewer HorizontalScrollBarVisibility="Auto" Width="1680" Height="750">
                <Canvas x:Name="videoCanvas">
                </Canvas>
            </ScrollViewer>
</Canvas>

and code from MainWindow.xaml.cs

 public MainWindow()
        {
            InitializeComponent();

            this.WindowStyle = WindowStyle.None;
            this.WindowState = WindowState.Maximized;

            getAllVideosFromFolder(System.IO.Path.GetFullPath(@"Videos\"));
        }

        private void getAllVideosFromFolder(string path)
        {
            try
            {
                var videoFiles = DirectoryHelper.GetFilesByExtensions(new DirectoryInfo(path), ".wmv", ".mp4", ".avi", ".mov");
                int i = 0, j = 0;

                foreach (var item in videoFiles)
                {
                    MediaElement melem = createMediaElementForPreview(item.FileName);

                    Canvas.SetTop(melem, i * 250);
                    Canvas.SetLeft(melem, j * 340);
                    videoCanvas.Children.Add(melem);

                    i++;
                    if (i > 2)
                    {
                        i = 0;
                        j++;
                    }

                    videos.Add(videoClass);
                }
                videoCanvas.Width = j * 340;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private MediaElement createMediaElementForPreview(string sourcePath)
        {
            MediaElement melem = new MediaElement();
            melem.LoadedBehavior = MediaState.Manual;
            melem.Source = new Uri(sourcePath, UriKind.Relative);
        melem.Width = 320;
        melem.Height = 240;
        melem.Volume = 0;
        melem.Play();
        melem.MouseDown += melem_MouseDown;
        return melem;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:05:31+00:00Added an answer on June 13, 2026 at 6:05 am

    There is no problem. MediaElement is complete shit and has many catastrophic bugs. It’s fine as long you use only one media element and bad quality video.

    Resort to your own DirectShow solution or see WPF MediaKit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a utility function in my program for searching for entities. It takes
I have function getCartItems in cart.js and I want to call that function in
I have function Start() that is fired on ready. When I click on .ExampleClick
I've been searching all day and found several similar issues, but none have resolved
So I have the function public Foo findVariable(Foo input) that returns an object of
I have this function I am using to decrypt values that works fine on
I have a function that accepts a string and generates an email attachment based
I have a jqGrid script like that: jQuery(document).ready(function() { var startDate = $(#startDate).Val(); jQuery(#sandgrid).jqGrid({
I am trying to make a firefox extension that will list all the videos
I have a function pulled from here . My problem is that I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.