Videos Uploaded with rails ActiveStorage to AWS S3 are downloaded instead of playing when calling (clicking) on the link generated - ruby-on-rails

this is kinda tricky.. let's make this clearer :
I'm using a ruby on rails app as back-end for my mobile application, when i upload a video from my ruby app Dashboard and store it on AWS S3 Storage it works perfectly, and when i retrieve the URL for the video it works as well , the thing when i click it it automatically download the video instead of playing it, i checked the meta data of the object inside my AWS Console it has the ( System defined Content-Type video/mp4 ) but as the attached screenshot show it doesn't recognize it as a video (as type is - as of null )
my response is always as JSON since i use the ruby app for the web services and the dashboard only ( i get the correct response )
PS: the video uploaded manually from the AWS Console plays when u open the link.
this is the difference between the video uploaded using my ruby app and the video uploaded manually which is highlighted in red

Look into how to set S3 Content Disposition with the library you're using. You'll need to probably do this when you're uploading the file, or you might be able to coerce it at request time when generating the link to the asset.

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

SoundCloud uploads from iOS have incorrect download file name

I'm using the iOS API to upload wav files to SoundCloud. There's no problem with the upload, however, when I attempt to download the file on the SoundCloud website the file name is always "unknown". When I upload the same song from my computer the file name matches the title.
There's nothing in the API reference that indicates you can set the download file name, so I assume it's generated from the title. Is this correct? Is there any additional metadata that needs to be set to make this work?
Any insight would be appreciated. Thanks!
When downloading a sound file from the SoundCloud website, the filename the user sees is the one used by the original uploader when they uploaded the sound to SoundCloud.

In Rails, how to create a button that when clicked download (not open) a movie stored in S3

I'm having a hard time trying to figure this out.
I have a button_to that should download a .mp4 movie that is stored on S3 when clicked. Since the audience is very basic, I need that when they click the button the download start right away. No right-click and Save As, just a button to send the file as download instead of open it on the browser.
I tried using send_file only to realize that it works for local files.
Any idea how to do this?
Just solved it using a link_to instead and link directly to the S3 file. Amazon automatically send the file to download instead of open in on the browser. Easier than I thought.
I would recommend just making it be a YouTube video. If you need privacy, make it an unlisted YouTube video.
If that is not an option, you should try to configure S3 to serve the following http header when delivering the file:
Content-Disposition: attachment

Direct uploading from user to another server in my rails app

I want the user to upload my his video file to dailymotion.
In my view I provide this input field...
[...]
<%= file_field 'file_path' %>
[...]
But this one causes my rails app to directly upload it to my rails app server.
I want the user to directly upload it to another server - dailymotion, in this case ( api works and doesn't matter here )
Can you guys help me or give me hints?
S3SwfUpload allows user to upload a file to S3 directly, so you can save the cost of uploading process in your app server..
go to https://github.com/nathancolgate/s3-swf-upload-plugin

Resources