microsoft / microsoft/FFmpegInterop

Audio not working on Windows Phone 8.1 when changing position

Open
#20 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
1.4k
Forks
319
PR merge metrics
No merged PRs in 30d

Description

Hello, I have faced a bug, when trying to play video file (avi, video codec: xvid, audio codec: ac3) on Windows Phone 8.1.
If I change position in MediaElement, audio is not working.
Code example (C#):

  1. I get MediaStreamSouce:
    IRandomAccessStream readStream = await file.OpenAsync(FileAccessMode.Read);
                // Instantiate FFmpeg object and pass the stream from opened file
                FFmpegMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromStream(readStream, true, true);
                MediaStreamSource mss = FFmpegMSS.GetMediaStreamSource();

myMediaElement.SetMediaStreamSource(mss);

  1. myMediaElement is MediaElement. It has MediaOpened event.
    And if I want to play my file not from the start, I can set myMediaElement.Position in MediaOpened event.
    So do I:
    private void myMediaElement_MediaOpened(object sender, RoutedEventArgs e)
    {
    Media.Position = TimeSpan.FromMinutes(5);
    }
  1. The result: video starts playing from the time I wanted (in this example - 5 minutes from the start), FPS is OK, but there is no sound.
    If I set myMediaElement.Pause and then myMediaElement.Play again several times, sound would appear. But new bug would appear too - FPS is dropping, so now I see not video, but a slideshow.

If I use Play and Pause again several times more, it would become OK (sound - ON, FPS - normal).

PS. If I start playing video from the very beggining (not setting myMediaElement.Positon), everything would be OK - video would play smooth and audio would work.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the AVI/Xvid/AC3 case on Windows Phone 8.1, using MediaElement.Position in MediaOpened to seek to five minutes. Inspect the FFmpegInteropMSS stream and seeking path involved in that scenario. Done means playback after seeking has working audio and normal FPS without repeated pause/play cycles.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.