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?