Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Support byte-range requests on Odoo Web server (werkzeug)?

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
werkzeughtml5webserver
4 Replies
8672 Rodiniai
Portretas
Evans Bernier

Hello,

I placed a video on a Odoo website homepage using HTML5 tags. The video size is arround 11 Mb. I can not play this video on iOS system only. I found the cause of the problem. For iOS, my web server need to support "byte-range requests" as see here : \http://stackoverflow.com/a/4762072

I put my video under an Apache Web server and I am able to play the video on iOS by using the URL to this video on Apache server. But, I would like to stock the video file on my Odoo custom module, then reach the video from my Odoo URL.

Is there a way to support "byte-range requests" on Odoo Web server?


Thanks

0
Portretas
Atmesti
Portretas
Ximple Things Pte. Ltd.
Best Answer

In case anyone requires any help or advice on this issue. I managed to write a custom controller to stream mp4 video file to all devices including iOS mobile devices. See the code snippet below for streaming mp4 video file from odoo.  Hope the code works for you, but streaming mp4 file from odoo is not recommended because of odoo is not meant for streaming media and it will affect odoo's performance if the video request gets too much.

Thus, my recommended solution is to setup apache2 to serve the video media. The load speed of the video is drastically faster than loading from odoo. 

Hope this helps.

@http.route(['/mainvideo'], type='http', auth="public", website=True)
    def website_mainvideo(self, **post):
        cr, uid, context, registry = request.cr, request.uid, request.context, request.registry
        mainvideo = ""
        with open("static/src/videos/homepage.mp4", 'rb') as mp4_file:
            mainvideo = mp4_file.read()
        headers = [('Content-Type', 'video/mp4'),('Accept-Ranges', 'bytes')]
        
        status = 200
        if request.httprequest.range:
            contentrange = request.httprequest.range.make_content_range(len(mainvideo))
            if contentrange.stop < len(mainvideo):
                status = 206
                headers.append(('Content-Range','bytes %s-%s/%s' % (str(contentrange.start), str(contentrange.stop), str(len(mainvideo)))))
            elif contentrange.stop > len(mainvideo):
                status = 416
                mainvideo = ""
                
        if status != 416:
            mainvideo = mainvideo[contentrange.start:contentrange.stop]
            headers.append(('Content-Length', len(mainvideo)))
        response = Response(mainvideo, status=status, headers=headers, content_type="video/mp4")
        return response

0
Portretas
Atmesti
Portretas
Christian Mahlich
Best Answer

Hi,

I just raised the same issue to Odoo. Unfrotunately the issue was not solved but just disabled to show the play button on iOS.

https://github.com/odoo/odoo/commit/5e3b471f4a67553d6f7525595b15dc3d7b4efb3f


This was the reply:

The explanation about your issue is:
HTTP servers hosting media files for iOS must support byte-range requests, which iOS
uses to perform random access in media playback. (Byte-range support is also
known as content-range or partial-range support.) But Odoo server doesn't support partial 
requests with accept-ranges.

So the fix was to unable the button play on IOS.
But we will try to improve it in master.
Thanks for your feedback.


Has anyone found a solution yet because I need this as well!

Do you maybe have some further information on the nginx "work around"
I cannot follow this and understand what actually is to do.

Thanks in advance!

0
Portretas
Atmesti
Portretas
Phillip
Best Answer

I do not think there is any way to support byte-range requests in Odoo server without modifications. You may be able to implement some of werkzeug's byte-range responses by designing a custom controller to handle your media. I have seen reference to byte-range handling in headers in werkzeug's docs however I have not seen a plug and play example for handling byte-range requests.


It took me quite a while to even determine why media was not loading on safari. I do not own an apple computer so using the developer tools is much more difficult. 


The simplest work around is on the same server you are hosting Odoo on you can define nginx or apache webserver to serve requests for Odoo using a reverse proxy. 


Define a specific set of paths that are handled exclusively by apache or nginx and host your media there. I have tested this and it works.


Another option is to use a CDN to host your media. And simply use a CDN that supports byte-range requests. Then just change the url on your Odoo server's html to point at your CDN. This approach has the additional benefit of lowering the number of requests on your server and frees up your bandwidth for other purposes.


Here is an example virtualhost config for apache. 


<VirtualHost *:80>
        ServerAdmin admin@example.com
        ServerName byterangetest.com
        DocumentRoot /var/www/media/
        ProxyPass /your_addon/static/src/vids !
        ProxyPass / http://byterangetest.com:8069/
        ProxyPassReverse / http://byterangetest:8069/
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
        ErrorLog ${APACHE_LOG_DIR}/error.log
0
Portretas
Atmesti
Portretas
Evans Bernier
Autorius Best Answer

Any news? It is an important case to be able to show video on Apple devices...

Thanks

0
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
custom design
html5
Portretas
Portretas
1
geg. 25
4687
werkzeug Response throwing error on v9
werkzeug
Portretas
0
gruod. 16
4704
How can I specify a werkzeug version on my openerp configuration?
werkzeug
Portretas
0
kov. 15
4851
How do I specify the path of an MP3 file for it to be accessible on website?
audio webserver
Portretas
0
saus. 22
3459
Odoo 11 - Missing <!DOCTYPE html> in some page of the website, e.g. shop
html5 odoo11.0
Portretas
1
geg. 20
5009
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now