Twilio Chat - How do i display upload progress of media? - twilio

I am trying to upload a picture to a channel using the code in this link:
const formData = new FormData();
formData.append('file', $('#formInputFile')[0].files[0]);
// get desired channel (for example, with getChannelBySid promise)
chatClient.getChannelBySid(channelSid).then(function(channel) {
// send media with all FormData parsed atrtibutes
channel.sendMessage(formData);
});
File is uploaded and image is shared successfully, but i would like to show upload progress to the user. How can i do it?
Also, while displaying images, is there a way to get thumbnail of the image first so as to not download the entire image unless user wants to see it?
No examples of the upload progress code is provided in Github sample project.

Twilio developer evangelist here.
I'm afraid that it is currently not possible to get progress events with the JavaScript API. Also, there is no thumbnails of images available either, you can get the image URL using message.media.getContentUrl() and that only resolves the promise with a single URL and doesn't take options.

Related

Processing stuck at 7 percent

I'm trying to upload a video using the API. I can successfully authenticate, upload and create a video and receive a video id. But when I query the processing status using https://api.dailymotion.com/video/{VideoId}?fields=status%2Ctitle%2Cpublishing_progress URL, it keeps returning "publishing_progress": 7 no matter how long I wait.
If I try to upload the same video using the website directly it will process it just fine.
I wonder if anyone else has encountered this issue and know how to solve it.
I think there is an issue with the source URL you associated to the video.
Have you correctly filled the URL field at the video creation (STEP 4.) with the URL returned by the API when you uploaded your video (on STEP 3.)?
If so, you would encourage you to contact our support with more details to dig further into possible issues

Youtube API v3 upload get Video Link

I am new to the Youtube API.
I am trying to use it to upload a file through my page on youtube.
Everything is working, and the File gets uploaded.
Now i want to display the link to the Video, so i can save it in the database. Its also enough if i can log it in the console and make an ajax call to save in the db.
The point is, i dont know how to get it.
I am using exactly the code form here:https://developers.google.com/youtube/v3/code_samples/javascript
You have it already, it's the video id in the response after you upload.
https://developers.google.com/youtube/v3/docs/videos#resource
Then the url is like this - https://www.youtube.com/watch?v=id

Programmatically download a Google Doc?

Google Docs have a "Download as..." menu option, with several choices of format such as PDF, text, etc.
How can I programmatically download a particular Google document?
From how to programmatically download a public Google Drive file?:
You don't need any Google SDK if you know the link and the file is public. Just use a standard HTTP GET method to download the file.
Example with AngularJS:
$http.get('/doc_url').
then(function(response) {
// this callback will be called asynchronously
// when the response is available
}, function(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});

iOS tweet image - Can I get the image url before upload?

I want to be able to share images from my app on twitter/facebook/email etc..
There's probably hundreds of different ways to do this which is quite simple.
However what I need/want to do, is allow the images to be opened by other people straight into my app (If they have it installed).
So I have a url scheme so a url will open my app with an image like this:
myurlscheme://image?url=http://imageurl.com
The problem I have, is the process for uploading the image, but adding my url scheme to the beginning of the url.
If I could know the url twitter/facebook is going to use before I send the tweet, I could add my url scheme to the front of the image url and put it in the tweet. I'm guessing this might not be possible though.
Another thought is to upload the image to another service, get the url, then compose and send the tweet. Are there any suitable services for doing this? (Preferably free services) I dont really want to have to host the images myself.
Thanks
1) I don't see how you plan on conjuring an image URL before you upload the image - that is a chicken/egg situation. I would recommend taking a look at an actual image URL after you upload it to facebook, twitter, etc and try to figure out even one character of what it would be for the next image you upload. Regarding twitter specifically the image URL is also going to vary depending on what upload service is being used.
2) regarding uploading the image and getting the URL why not look into tapping into the flickr API?

Is it possible to set the content rating using the YouTube .NET API w/ Direct Upload?

If I'm upload some items that should have a content rating, how can I set that via the API?
Here's some tidbits of the code:
Dim newVideo As Video = Nothing
newVideo = New Video()
newVideo.Title = title
That's a part of it, can we set the rating ourselves within the API or is that functionality not there yet?
Also, if a video is blocked or flagged worldwide, do YouTube provide that in the upload successfully response, if a video uploads okay, I can get the ID, but can I also check to see if there's any complaints? I will ignore the Duplicate response for now. But I am more worried about the flagged or block as you only get three strikes.
Setting content rating isn't supported via the API.
If a video is not playable for any reason, including the reasons you mention, it will have an explanation of the problem in yt:state:
https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_yt:state

Resources