Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Retrieval and display Video from Azure Blob Storage, to Flask Python, to HTML/JS?

I have a .mp4 video file located in an ADLS Gen2 storage account that I am trying to display in a simple Flask webapp. For simplicity’s sake I am hardcoding all of the URL’s until I am able to get it to work.

When I enter the URL without a SAS in the connection string, the webpage displays: ResourceNotFoundThe specified resource does not exist. RequestId:xxxx-xxxx-xxxx-xxxx-xxxx Time:xxxx.

When I append the SAS to the end of the URL, my browser downloads the file, but it doesn’t display it on the page.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I am trying to display the video in the browser, and have the ability to play it (in browser). Below is my code, any input it greatly appreciated!

@app.route('/playVideo/', methods=['GET'])
def playVideo():
    return render_template('playVideo.html')
{% extends 'base.html' %}

{% block content %}
<h1>Hello world!</h1>

<iframe src="https://mystorageaccount.blob.core.windows.net/video/xxx-xxx-xxx/xxx-xxx-xxx..mp4" width="853" height="480" frameborder="0" allowfullscreen></iframe>
{% endblock %}

>Solution :

When I enter the URL without a SAS in the connection string, the
webpage displays: ResourceNotFoundThe specified resource does not
exist. RequestId:xxxx-xxxx-xxxx-xxxx-xxxx Time:xxxx.

This is happening because the ACL of the blob container is set as Private. If you want to access a blob directly by its URL, you will need to set the ACL of the blob container to be either Blob or Public.

When I append the SAS to the end of the URL, my browser downloads the
file, but it doesn’t display it on the page.

Please check the content-type property of the blob. In all likelihood, it is set as application/octet-stream. Update the blob property and change it’s content-type property to video/mp4 and that should take care of this problem.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading