2 followers Follow

Direct link to a recorded video - play in browser or download?

Hi, it's me and yet another obscure problem :) 


We have an option to add a video to a composed email on our website, and it's added to the email body as a direct link to the video file on server (<app token>/videos/<video token>/video.mp4).


The users click the link and expect it to open and play in their browser, and that's what usually happens, but not always. From time to time it switches to always downloading the video file instead of playing for no apparent reason (same browser, same browser settings, same video file), and then switches back to playing. And it happens often enough that the users notice and think that something went wrong :)


It just happened to me, too, so I've compared the headers. The requests are identical, except for the actual IP address of the remote server, and the content-type of the response - it flips between video/mp4 and application/webm, which, in turn, means the difference between playing in browser or downloading as file, and that, in turn, means that the user experience kind of depends on which server has been picked by AWS load balancer :). Edited: actually, it looks like any server can return either video/mp4 or application/webm as content type for any given file (serves me right for looking for patterns in all the wrong places :))


Now, I understand that you probably have little control of what Cloudfront does when anyone accesses files stored there, but I'm still posting this in case you've encountered anything like this before and maybe know why it seems to give different content types for the same file in the first place :)

I can send full request/response headers to the support email, if that helps.


Thank you in advance!


Please sign in to leave a comment.



Hi :)


Please do feel free to write any types of questions, regardless if the context looks obscure or not :)


Now based on what you have described I would presume that you are sending the email as soon as the video is recorded?


Also can you please just try something to see if you end up getting the same results each and every time? For example just add ?starwars=awesome at the end of the URL of your video for example.

It can be anything really.


I presume that what is happening is that some of the CloudFront servers are still for some reason showing you the original video stream, which is normal, however let me explain why.


First the videos come in packed in different formats. They can be mp4, avi, webm, etc. depending if they are uploaded or recorded, and even when recorded they can still be in different file formats.


Now CloudFront might pull the original stream at the first time, because that is the only one available. Then once the default stream is created (after processing the original stream) that one is pulled.


Now somewhere in their huge net of cached goodies, the original stream is still hiding and just waiting to pop up. As that server (holding this "old" stream) becomes the best pick to send you the video from, it shows you this other stream.


Well that is at least the theory based on what you described, and most likely scenario. Adding the parameter (of any kind) would however make sure that only a new (latest) video is being shown.


This is something our players actually do automatically, so if you were to inspect the player, you would see that a random value is being added each time since that helps with the local cache, ISP level cache and of course CDN cache.


Now another thing that I would suggest is to include a link to either:

  1. Your own page on your website, where you might show additional info or add any sort of call to action around the video or
  2. Send a link to the hosted video page.


The later is basically a link in a format such as this:{VIDEO_TOKEN}


It would have our video player in it, so you would always get the same player shown.


Also it is good to mention that some browser do sometimes choose if they would rather download the video or play it, so it is possible that they react differently depending on the setup, while the video hosted page would still just play it up for them.

* You can also edit this page.


For reference, do check the following:

  1. Log into your account of course
  2. Click on the application that you would use / where videos are
  3. Click on Hosted pages
  4. Scroll down and you will see the option "Let us host separate subpages for each single video"
  5. Check the option
  6. Optionally edit this hosted page by clicking on the link like potion bellow this


Do let me know if either options work in your use case and if the URL parameters do the trick.



Bane 0 votes
Comment actions Permalink

Hi Bane,


Thank you so much for the explanation :) Now that we know what must be going on it would be easier to make a decision about what to do with it (and I didn't even think that recorded videos still can end up being saved in different formats).

I'll try the workaround with adding a parameter to URL, but it might take some time to trigger the issue itself again (I tried a couple of times and it didn't pop up at all). But I agree that directing users to a page with embedded player would be the most robust solution in any case, so this is what we are probably going to do.

Thanks again!

DarthVeyda 0 votes
Comment actions Permalink


Happy to help :)

In terms of formats, yes, it can be in many different formats, not just webm. The file format largely depends on the browser used, and then there is encoding engine... many things happen before the video reaches our servers :)

This is why we transcode all videos in the mp4 streams, so they are always the same, regardless of the format that it was uploaded in.

If you are using the page, then just adding our player would be enough. It will add things to the URI request so it always gets the latest video.


Bane 0 votes
Comment actions Permalink