Currently in Clip It we allow users to save Audio. However the audio that they are looking at usually comes from the result of AssetService:SearchAudio(). The issue comes from when a player rejoins, there’s no way to grab the same exact data from the Audio’s ID. For example, there is no way to grab the correct Title or Artist values as they can be different as seen below:
Repo (this will sometimes work sometimes not, depends on the audio and creator themselves if the names are the same):
local AssetService = game:GetService("AssetService")
local MarketplaceService = game:GetService("MarketplaceService")
local audioSearchParams = Instance.new("AudioSearchParams")
audioSearchParams.AudioSubType = Enum.AudioSubType.Music
audioSearchParams.SearchKeyword = ""
local audioPages = AssetService:SearchAudio(audioSearchParams)
local result = audioPages:GetCurrentPage()[1]
local info = MarketplaceService:GetProductInfo(result.Id, Enum.InfoType.Asset)
print(result, info)
Expected behavior
I would like an AssetService method to be able to grab the exact data per audio asset id.
If you are saving the audio asset ids for each player then consider using the AssetService: GetAudioMetadataAsync method. It has higher rate limits than SearchAudio and you can query by id rather than keyword for exact matches.
Thank you! Yeah for some reason at some point we switched out GetAudioMetadataAsync an instead just loaded the data we stored, which was producing bad data. Switched it back to request the audio data with that method and everything seems to be working fine. Thank you!
Hey! I have been using AssetService:GetAudioMetadataAsync and I noticed that for some results, it will be missing the Title field. I was wondering if you knew why?
I can reproduce the title being missing for that asset. I think this time I figured out the root cause for this issue and will be deploying a fix later today. Sorry for the inconvenience this has caused you and thanks for reporting this bug.
Hey! I was wondering if there were plans to correct the Duration field for results. I’ve noticed that if you try to request data for an audio that’s < 1 second, it will provide an inaccurate result which in our specific case breaks multiple of our systems.
However, if you load the sound itself you can see that the duration is really 0.293
This is specifically an issue in Clip It where we need to guaruntee the actual duration of an audio to properly display it in our timeline for users making clips. I also do not think it should be the developers problem to deal with since we are supposed to have an API to deal with this ourselves and it is extremely frustrating to constantly have to be battling with this API.