Repository navigation
feat: stream music from StreamingAssets, played by the page on Web - #145
Merged
Merged
Conversation
Music no longer rides in the Web build's .data download or the wasm heap. Tracks are plain files under StreamingAssets; MusicState (ln.web) says which track, how loud and how fast to fade. On the Web build the overlay (web/src/music.tsx) streams the file through an <audio> element into a gain node (fades work on iOS, which ignores audio.volume) and starts on the first gesture. In the editor and on desktop, Core/MusicPresenter loads the same file into an AudioSource on a DontDestroyOnLoad object that also carries the app's AudioListener. Title plays content/title.txtpb's music and fades it out over the Play push; the fade now carries on across the scene change. Replaces the Title-scene TitleMusic component. Web .data: 8.4 MB -> 5.6 MB.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the title music out of the Web build's
.datadownload and the wasm heap.StreamingAssets/Music/, served next to the build.MusicState(proto/luckynumbers/v1/music.proto,ln.web) holds the track, volume and fade time. CoreIMusic(MusicPresenter) sets it, and it lives in the root scope, so the music keeps going (and fading) across scene changes.web/src/music.tsxstreams the file into an<audio>element and through a Web Audio gain node, so fades work on iOS too, which ignoresaudio.volume. Playback starts on the first click, key or touch.MusicPresenterloads the same file withUnityWebRequestMultimediainto an AudioSource on aDontDestroyOnLoadobject. That object carries the app's one AudioListener, since no scene has one.title.txtpbmusic(track, volume 0.6, 2 s fade-in) and fades it out over the Play push. This replaces the Title-sceneTitleMusicfrom feat: title music (Break Beat Jazz Fusion) #144.Web
.data: 8.4 MB → 5.6 MB.ln.py check: 0 errors.tests: 77/77.tsc: clean.build-web: OK. Served mp3 resolves atStreamingAssets/Music/BreakBeatJazzFusion.mp3(audio/mpeg). Not listened to in a browser yet.