Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I play an audio file that is INSIDE the executable? #10

Open
Templayer opened this issue Mar 27, 2024 · 7 comments
Open

How do I play an audio file that is INSIDE the executable? #10

Templayer opened this issue Mar 27, 2024 · 7 comments

Comments

@Templayer
Copy link

The examples only contain absolute paths, which are pretty much useless in most scenarios.

So far I have been unable to load it as an Avalonia resource, i.e. avares://blahblah

If I use a relative path, it won't work in all cases, as most publishing configurations I have pack the entire application into one file. How do I reference the audio file in that case?

image

@mysteryx93
Copy link
Owner

mysteryx93 commented Mar 28, 2024

It wasn't designed with that scenario in mind. It would require adding the SourceStream property.

Which player implementation are you using?

And in which scenario do you need a player interface for internal audios?

@Templayer
Copy link
Author

It wasn't designed with that scenario in mind. It would require adding the SourceStream property.

Which player implementation are you using?

And in which scenario do you need a player interface for internal audios?

image

Retro form-based videogame development. I don't think I would be able to produce a proper signed .apk Android version without that feature, so that is my scenario. And the whole purpose of Avalonia is to have a multiplatform GUI.

Adding that feature (ideally being able to use Avalonia Resources) together with an example would be much appreciated.

Strangely enough, using bass.dll and bassflac.dll from INSIDE the Win executable works (instead of them being inside the same folder as the .exe file). Instead of crashing on init, it shows the music player, but the music player says it couldn't read the media file or a generic message akin to that. This means that the Avalonia Bass Player is the only bottleneck that prevents me from doing that.

    <!--TODO others-->
    <ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64' 
                       or '$(RuntimeIdentifier)' == 'win' 
                       or '$(RuntimeIdentifier)' == 'win7-x64'">
        
       <ContentWithTargetPath Include="BassLibraries\win-x64\bass.dll">
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
           <TargetPath>bass.dll</TargetPath>
        </ContentWithTargetPath >
        <ContentWithTargetPath Include="BassLibraries\win-x64\bassflac.dll">
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
            <TargetPath>bassflac.dll</TargetPath>
        </ContentWithTargetPath >

        <!--Adding a <None> entry for the file will ensure that it still shows up in Visual Studio's UI says the internet.-->
        <None Remove="BassLibraries\win-x64\bass.dll" />
        <None Remove="BassLibraries\win-x64\bassflac.dll" />
        
    </ItemGroup>

@Templayer
Copy link
Author

Any news? Are you willing to implement it?

@mysteryx93
Copy link
Owner

mysteryx93 commented Apr 20, 2024

It should be pretty trivial change; just been really busy with other priorities lately.

Feel free to make the changes to the repo.

The only part that will require a bit of care is making sure there's no bugs or conflicts between setting Source or SourceStream; but at the end of the day, setting Source is really setting the SourceStream.

@Templayer
Copy link
Author

It should be pretty trivial change; just been really busy with other priorities lately.

Feel free to make the changes to the repo.

What is trivial to you is not trivial to me.

Besides - the main reason why I am using this library is NOT to have to code it myself, because I am trying to code something else entirely. :p

@mysteryx93
Copy link
Owner

ok started taking a look. Indeed it's not as trivial as I thought.

@Templayer
Copy link
Author

😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants