UnityPlugin-AVProVideo icon indicating copy to clipboard operation
UnityPlugin-AVProVideo copied to clipboard

Setting mediaPlayer.AudioMuted = true not working. Have to make SetPlaybackOptions public and call from mediaPlayer.Events.AddListener

Open wybo opened this issue 1 year ago • 1 comments

Describe the issue Setting mediaPlayer.AudioMuted = true not working for videos opened afterwards with mediaPlayer.OpenMedia(new MediaPath(...)).

Have to make SetPlaybackOptions public in MediaPlayer.cs and call from a listener (added with mediaPlayer.Events.AddListener()) to make it work. Which is ok. But I thought it useful to report the issue, so it can be fixed, and others can work around it in the meantime.

More info:

SetPlaybackOptions() is called when opening the new media. I tested that.

Looks like something isn't loaded yet when SetPlaybackOptions() is called. I checked and the _controlInterface is not null, and set to Windows Media player. So that can't be it. Must be something internal in Windows Media Player that makes a call to SetPlaybackOptions not do its job early on.

Symptoms:

In the Editor UI the AudioMuted is ticked but audio is playing. When manually setting it, it works, but then doesn't when a new video comes on. Also tried to set the volume to 0f. Which doesn't work when set through code. It does when touched on the Edutor UI (both do). But it does not carry to the next video opened. So the above manual call once the FirstFrameReady event type is there is the only workaround for now.

Same issue exists with the PlaylistMediaPlayer. Even when both MediaPlayers have their AudioMuted set to true as well, in addition to the PlaylistMediaPlayers AudioMuted being true.

Your Setup (please complete the following information):

  • Unity version: 6
  • AVPro Video version (number and edition (trial/core/ultra/enterprise)): Core. Latest.
  • Operating system version: Win 10
  • Device model: PC
  • Video specs (resolution, frame-rate, codec, file size): HD, nothing special

To Reproduce

  1. Create a mediaPlayer through code and set mediaPlayer.AutoMuted = true
  2. Open one or more videos with mediaPlayer.OpenMedia(new MediaPath(...)).
  3. Hear the audio, which should have been muted

wybo avatar Aug 20 '24 12:08 wybo

Does it work if you set it in the component rather than through scripting? Have you tested it in other Unity versions, such as 2022 or 2023? afaik Unity 6 is still in preview?

Chris-RH avatar Aug 20 '24 12:08 Chris-RH

If this is Windows only, then we think this has been fixed in v3.0.10. Marking as fixed and closing. Do let us know if this is not the case @wybo

Ste-RH avatar Sep 09 '24 16:09 Ste-RH

Using v3.0.10 on windows, I can confirm the issue persists. After setting AudioMuted=false from script the "Muted" box is ticked in editor, but sound is audible.

Kalumo avatar Oct 23 '24 12:10 Kalumo

Reproduced

Ste-RH avatar Oct 23 '24 13:10 Ste-RH

There will be a fix for this in the next release (v3.1.1) which is due later this week.

Anyone requiring an imediate fix can make this addition into WindowsMediPlayer.cs inside the OpenMedia(...) function:

image

Ste-RH avatar Oct 23 '24 13:10 Ste-RH

AVPro Video v3.1.1 has just been released. Please do let us know if this fixes your issue.

Ste-RH avatar Oct 25 '24 16:10 Ste-RH