This question was created in reference to: [Sequencer: Media Track Sound [Content removed]
I’m hoping the state of this issue has changed in the intervening years. After following the steps above the movie plays fine when scrubbing in the sequencer but there’s no audio. I’ve verified my viewport’s Level Editor Volume is set to max. I’ve also tried adding an Actor to the level with Media Sound Component with the same result - nothing I’ve tried causes audio to play in the viewport.
The workaround - extracting the audio into a separate WAV and playing them both - adds some error cases that I’d rather avoid. Is there anything that can be done to get Media audio working in editor, with or without PIE?
Create a Level Sequence that auto-plays for the Level. Add a Media track to the sequencer, click the + and add the File Media Source created above. Set the Media Texture to the Media Texture created above, and the “Media Sound Component” property to a Media Sound Component with Media set to Media Player created above.
I consulted with the dev team on this, and there are a couple of reasons this hasn’t been implemented yet. The main reason is that the common use case for media player playback is similar to YouTube playback: when you scrub, you don’t get audio playback, and it is different from scrubbing in a video editor. From an implementation perspective, this raises a few questions and, in turn, a few hurdles for the Media Player. When you scrub, how many milliseconds of audio do you want to hear for it to be perceptible and useful? Lastly, the media player is intended for continuous forward playback and generally doesn’t work well with scrubbing in the sequencer, so you may drop audio or drop frames (because synchronization happens to the audio in the media player), and you might get perceptible timing inaccuracies.
Suffice it to say, the devs feel that your workaround is probably the best solution to the missing feature.
For scrubbing I absolutely agree with you - playing random snippets of audio while scrubbing through the sequencer isn’t helpful.
What I failed to mention is that this behavior is true when playing in the sequencer as well. After clicking play the audio never plays. Continuing the analogy, the YouTube video is stuck on mute.
In that case, we would recommend that, in the media track, you use “external player” and point it to the media player created in the Content Browser. If that is not done, the media track will create its own transient media player, and nothing connects.
In your media sound component on an actor, point it to the same media player from the Content Browser. That way, the media track is triggering the playback and audio should be heard, at least in PIE.
In that workflow, “bTickInEditor” is disabled on the sound component if created manually so it should be possible to inherit a new component from UMediaSoundComponent and make it tick in editor.
UEditorPreviewMediaSoundComponent::UEditorPreviewMediaSoundComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// An editor world only reports itself as "game ticking" to the audio device when Enable Real Time Audio is on,
// and sources for anything else are dropped in FAudioDevice::StartSources. UMediaPlateComponent flags its own
// sound component the same way for the same reason.
bIsUISound = true;
}
void UEditorPreviewMediaSoundComponent::OnRegister()
{
const UWorld* World = GetWorld();
const bool bPreviewInThisWorld = bEnableEditorPreview && World != nullptr && !World->IsGameWorld();
bTickInEditor = bPreviewInThisWorld && TickSource == EEditorPreviewMediaSoundTickSource::WorldTick;
// Super activates the component, which is what lets UpdatePlayer() register the audio sample sink.
Super::OnRegister();
if (bPreviewInThisWorld && TickSource == EEditorPreviewMediaSoundTickSource::MediaClock)
{
AddClockSink();
}
}
void UEditorPreviewMediaSoundComponent::OnUnregister()
{
RemoveClockSink();
Super::OnUnregister();
}