locked
running video continously in media element RRS feed

  • Question

  • I am simulating video chat application where I want to continuously run video in mediaelement. Every time I call stopCapture menthod I will be setting source of MediaElement and it flickers. Is there any way where using this approach I can continuously run video in MediaElement and there wont be any flickering. Below is my code:

    async private void stopCapture(object sender, RoutedEventArgs e)
             {
                 await mediaCapture.StopRecordAsync();
                 await randomAccessStream.FlushAsync();

                 randomAccessStream.Seek(0);

                 byte[] streamBytes = new byte[randomAccessStream.Size];
                 DataReader dataReader = new Windows.Storage.Streams.DataReader(randomAccessStream);
                 await dataReader.LoadAsync((uint)randomAccessStream.Size);
                 dataReader.ReadBytes(streamBytes);


                 IRandomAccessStream receiverRandomAccessStream = new InMemoryRandomAccessStream();
                 DataWriter dataWriter = new DataWriter(receiverRandomAccessStream);
                 dataWriter.WriteBytes(streamBytes);
                 await dataWriter.StoreAsync();


                 receiverRandomAccessStream.Seek(0);

                 
                 mediaElement.SetSource(receiverRandomAccessStream, "video/x-ms-wmv");

                
             }

    Thursday, October 17, 2013 1:00 AM

All replies

  • Just think out loud here... what if you have multiple Media Elements where one is ready and the other queued up, ten you swap between them when you switch video?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, October 17, 2013 1:00 PM
    Moderator