Unable to upload sound file via Twitter API


#1

I would like to upload a sound file via the twitter API. I prefer not to include a URL within the tweet. Instead, I would like the sound to be playable directly from the tweet just as it would if the file was a video or gif. My sound file extension is ‘.caf’ as I am developing on iOS currently. Can someone guide me within the right direction?

I am posting to this endpoint, “/1.1/media/upload.json” and receiving this error:
error = “media type unrecognized.”;

I am using the chunked method to upload the media file.


#2

Unfortunately we don’t support attaching audio files to Tweets. The media upload endpoint is intended for images, animated GIFs and video files only, so that’s why you’re seeing that “unrecognised” error.


#3

Andy,

Thanks for the response. Is this support in the works or on the roadmap for the API?

Thanks


#4

I’m not aware of any plans to add this I’m afraid.


#5

Andy,

Thanks, that’s unfortunate. Is it possible to post a link to the audio file via a tweet as a workaround?

Thanks


#6

Yes, but that would just be another web link that would cause the user to jump out of Twitter to your site. You could potentially also use a Player Card by annotating your hosting site with appropriate tags.


#7

Basically, I am implementing functionality where users within my iPhone application can choose to share/post media to their twitter feed. Each time a share occurs, the link within the twitter:player content tag will change since the file source will change for every new media upload to my server. Based on my research around player cards, cards are static and cannot be used on the fly. If that is the case, I do not know if I can use player cards for my use case. Is this correct or am I misinterpreting the player card documentation? Please let me know.

Thanks…


#8

Yeah, that would be correct. Unless you are able to generate a unique page with a card each time, that wouldn’t work - sorry :dizzy_face:


#9

Thanks.

Question, is there documentation around the Audio Player card? My assumption was, the video player card is to be used in order to post audio. I have read from a number of sources that there is a new card now available, the Audio Player card. Is this true? Browsing through the twitter dev site, I was unable to find any examples or information around the audio player card.


#10

This card is experimental and is not generally available for all third parties at this time, apologies. That’s the reason why you won’t find documentation available.


#11

Nice. I would like to experiment with the new card. Does it support .caf audio files?