none
[UWP]playing audio with fliping images according to audio track

    Question

  • Dear all,

    i have an audio file in mp3 format. that audio file is a lecture on a book. i have converted the book into images.

    i want to create a page which play the audio and show images as the audio playing. for example, the first 10 minutes of the audio track is related to page 1, so page 1 should keep displaying during these 10 minutes. after 10 minutes, page 2 should be displayed for the next 5 minutes, and so on and so forth.

    one idea was to merge the audio and images and create a video file out of it, and display it in my page.

    the problem is that, its a huge data, a lot of lectures on many books. i try to create one video from a 34 minutes audio, and it creates 550mb video file for me. that is cannot afford, even the end user cannot wait for that much longer for the video to be download from internet.

    the mp3 audio file itself is smaller, it is 11mb, i can greatly reduce the network overhead if i can manage with audio and images only. can somebody guide me thoroughly for this as i am very much beginner to uwp.

    i am using visual studio 2017 latest updated version.

    thanks



    Monday, November 12, 2018 10:02 AM

All replies

  • Hi,

    So based on your words, what you want is that you want to start audio at specific times right? For example let the audio play from 10th minutes no matter how long it has played in page 1 after the page is turned to page 2.

    This could be implement by change the MediaPlaybackSession.Position Property. This property gets or sets the current playback position within the currently playing media.

    I made a simple demo that you could refer:

     private void Button_Click(object sender, RoutedEventArgs e)
            {
                mediaPlayer = new MediaPlayer();
                mediaPlayer.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/123456.mp3"));
                //start at 25th second. You could choose TimeSpan.FromMinutes or other methods
                mediaPlayer.PlaybackSession.Position = TimeSpan.FromSeconds(25);
                mediaPlayer.Play();
            }

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 13, 2018 5:46 AM
    Moderator
  • Hi,

    Have you solved the problem? Is my answer helpful?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 6, 2018 10:05 AM
    Moderator