Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

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

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
werkzeughtml5webserver
4 Besvarelser
8675 Visninger
Avatar
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
Avatar
Kassér
Avatar
Ximple Things Pte. Ltd.
Bedste svar

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
Avatar
Kassér
Avatar
Christian Mahlich
Bedste svar

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
Avatar
Kassér
Avatar
Phillip
Bedste svar

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
Avatar
Kassér
Avatar
Evans Bernier
Forfatter Bedste svar

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

Thanks

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
custom design
html5
Avatar
Avatar
1
maj 25
4687
werkzeug Response throwing error on v9
werkzeug
Avatar
0
dec. 16
4704
How can I specify a werkzeug version on my openerp configuration?
werkzeug
Avatar
0
mar. 15
4851
How do I specify the path of an MP3 file for it to be accessible on website?
audio webserver
Avatar
0
jan. 22
3463
Odoo 11 - Missing <!DOCTYPE html> in some page of the website, e.g. shop
html5 odoo11.0
Avatar
1
maj 20
5009
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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