Announcement

Collapse
No announcement yet.

Custom Music Player

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Is there a way to access the various media players from within Unreal Engine 4? What I would like to be able to do is play a tune or playlist from windows media players where I control it from within the engine.

    Comment


      #17
      Sorry for the delay

      I got it work. Here's my code. With this actor I can play an arbitrary OggVorbis file from hard disk.
      I used trigger boxes and lights for testing purpose, if you're not interested you can obviously remove all those stuff.
      MusicPlayerActor.h
      MusicPlayerActor.cpp
      Many thanks to mgriffin_pitbull

      Originally posted by Demolition Man View Post
      Is there a way to access the various media players from within Unreal Engine 4? What I would like to be able to do is play a tune or playlist from windows media players where I control it from within the engine.
      AFAIK there's no way to automatically detect and control other media players.
      If you _really_ want to do this...you should look for every known media player files in the user's hard disk, for each one of your target operating systems or devices. Then for each result you should find out media player API and implement a wrapper for Unreal Engine.
      An easier way can be using libvlc [see previous comments above]. Essentially you embed Video LAN Client core libraries in your game and you can be sure that libvlc / libvlccore API can be used on your target platform. I suggest VLC because it is open source and (one of) the most well documented media player you can find.
      Otherwise you can extend this simple music player in order to support playlists (I'd also like to do so but I'm currently working on other projects and I'm not sure I can have results in short time) and other file formats (decoder needed).

      I have noticed a not-so-funny-feature (aka bug) in my code: when I run my exported .exe game in windowed mode and I bring the focus out of the game (ie Alt + Tab to focus other programs) the sound is muted. The song goes ahead in play but is muted till I bring back the focus in the game (ie click in the game window). Is there a way to keep the music on also when the game is not focused?

      Comment


        #18
        This actually came up on Answerhub the other day: https://answers.unrealengine.com/que...ing-focus.html

        Comment


          #19
          Apologies for pulling back and old thread - information on this subject is thin on the ground so it seems as good a place as any.

          Looks like OGG loading support is desktop only (WITH_OGGVORBIS depends on PLATFORM_DESKTOP).

          Following this other thread here I have WAV files loading on PC and MAC but not iPhone. No errors just no WAV playing. Still need to debug this further - could be something simple like endianness of data - but thought I'd post here and see what the latest thoughts were on cross platform raw audio loading in game.

          Test case I'm working towards is user generated content, where I don't expect the user to have unreal editor installed - eventually they might be editing data through a simple web interface.

          Any shortcuts on my voyage of discovery gratefully received!

          -Tom

          Comment


            #20
            so amazing

            Comment


              #21
              Hi [MENTION=10459]keru[/MENTION], is it possible to play an .mp3 or wav file using your code as well?

              Cheers!

              Comment


                #22
                Originally posted by Bushey View Post
                Hi [MENTION=10459]keru[/MENTION], is it possible to play an .mp3 or wav file using your code as well?
                Last time I tried, no.
                Please refer to the previous comment from Tom to enable other encoding support.
                Originally posted by theonecalledtom View Post
                Looks like OGG loading support is desktop only (WITH_OGGVORBIS depends on PLATFORM_DESKTOP).

                Following this other thread here I have WAV files loading on PC and MAC but not iPhone. No errors just no WAV playing. Still need to debug this further - could be something simple like endianness of data - but thought I'd post here and see what the latest thoughts were on cross platform raw audio loading in game.

                Comment


                  #23
                  I was able to run a server running the editor that could import wav files and convert to uassets which the game could read. This whole process is horrible and in the end I may not use it (running the editor requires an expensive server).

                  Non uasset code support is not consistent across the platforms.

                  If this situation changes I'm very interested, but I sank a fair amount of time into this hit lots of brick walls.

                  IF there was a standalone tool like unrealpak that could do the convertion without GPU requirement then the cost of running a conversion server would drop significantly.

                  The ideal would be native cross platform support for loading wav files, just like you can load standard image formats.

                  Comment


                    #24
                    Is anyone able to advise me on the best way of loading wav or mp3 files during runtime. I'm working on an app that amongst other things would allow users to play their own music during the game.

                    Any help with Blueprints or ideas of how this could be achieved would be appreciated :0

                    Cheers!

                    Comment


                      #25
                      Originally posted by Bushey View Post
                      Is anyone able to advise me on the best way of loading wav or mp3 files during runtime. I'm working on an app that amongst other things would allow users to play their own music during the game.

                      Any help with Blueprints or ideas of how this could be achieved would be appreciated :0

                      Cheers!
                      This is what i need exactly
                      ABC Augmented Reality by UE4
                      GooglePlay

                      ArchVis VR

                      Comment


                        #26
                        Originally posted by Bushey View Post
                        Is anyone able to advise me on the best way of loading wav or mp3 files during runtime. I'm working on an app that amongst other things would allow users to play their own music during the game.

                        Any help with Blueprints or ideas of how this could be achieved would be appreciated :0

                        Cheers!
                        Wait for next year - the patent on some MP3 stuff expires next year so there's no legal consequence to compressors and decompressors using the format, as I understand it. We'll probably see a few plugins offering streaming mp3 support then.
                        iTween For UE4
                        Procedural pathed animation for actors, components & UMG - $0
                        Runtime DataTable
                        DataTables dynamically loaded from text or Google Sheets while your game is running!
                        easyCSV
                        Fast, cheap, and accurate CSV parsing at runtime!

                        Comment


                          #27
                          I'm happy to use .ogg files for the meantime if that's all that is available. I'm surprised that no-one has made a music player module that can be sold on the UE4 Marketplace. If one existed I'd buy it in a heartbeat. I'd like to make my own, but I'm more artist than programmer and the whole thing mystifies me unfortunately. :/

                          Comment


                            #28
                            I've been looking around for a music player, if anyone knows of one that's pretty much plug and play then please let me know. Ideally it would have a ui, I'm happy to reskin it and make it pretty but the functionality needs to be there.

                            Comment

                            Working...
                            X