Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Use the video preview widget in odoo 16

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
widgetpreviewvideosolvedodoo16features
1 Antworten
4863 Ansichten
Avatar
dunghn

I want to use the video preview widget in odoo 16.

I can't import video inside odoo.tools

Here is the code snippet by Bhavin Patel.


from odoo import models, 

fields, api from odoo.tools import video

class VideoExample(models.Model): 

_name = 'video.example' 

name = fields.Char(string='Name') 

video = fields.Binary(string='Video', attachment=True) 

video_preview = fields.Binary(string='Video Preview', compute='_compute_video_preview') 

@api.depends('video') 

def _compute_video_preview(self): 

for rec in self: 

rec.video_preview = video.Video.from_binary(rec.video).preview_image() if rec.video else None

0
Avatar
Verwerfen
Bhavin Patel

our code seems to be correct. It defines a new model VideoExample with three fields: name (a Char field), video (a Binary field for the video file), and video_preview (a computed Binary field for the preview image).

The video_preview field is computed based on the video field using a custom method _compute_video_preview, which generates the preview image for the video using the odoo.tools.video module.

The odoo.tools.video.Video.from_binary method is used to create a new Video object from the binary data of the video field. Then, the preview_image method is called on the Video object to generate the preview image, which is returned as a binary data and assigned to the video_preview field.

The if rec.video else None expression at the end of the line ensures that the video_preview field is set to None if there is no video file present. This is a good practice to avoid potential errors and unexpected behavior.

Overall, this code should work correctly to generate video preview images for the VideoExample model based on the uploaded video files.

Avatar
Bhavin Patel
Beste Antwort

In Odoo 16, you can use the video preview widget to display a preview image of a video file, along with a play button that allows the user to play the video. Here's how you can use the video preview widget in your custom module:

  1. Add a new field to your model that represents the video file:
Python:

In this example, we're adding a new Binary field for the video file, as well as a Char field for the filename and a computed Binary field for the video preview image. The video_preview field is computed based on the video_file field using a custom method _compute_video_preview, which generates the preview image for the video.

  1. Add a new view for your model that includes the video_preview field and uses the video preview widget:
    XML:

In this example, we're adding a new view for the form of the MyModel model that includes a tag with two tags. The first tag is for the video_preview field, and uses the video_preview widget to display the preview image and play button for the video. We're also passing an options dictionary that includes the filename field (video_filename) to use for the video. The second tag is for the video_file field, and includes the filename attribute to use for the filename.

  1. Implement the _generate_video_preview method to generate the preview image for the video. You can use a third-party library such as ffmpeg or moviepy to extract a frame from the video and save it as an image. Here's an example implementation using ffmpeg:
python:

In this example, we're using ffmpeg

1
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Video Preview Widget in Odoo 12? Gelöst
widget preview video odoo12 Odoo13.0
Avatar
Avatar
Avatar
Avatar
3
Apr. 23
7278
How to use video preview widget in odoo 16 ?
preview odoo16features
Avatar
Avatar
2
Apr. 23
4907
How to use work_permit_upload widget in Odoo16.
widget odoo16features
Avatar
Avatar
1
Apr. 24
3264
(Odoo 16) widget: many2many_checkboxes need more features
xml widget odoo16features
Avatar
Avatar
1
Mai 24
2766
How to see the preview of the file i import ?
import preview odoo16features
Avatar
0
Nov. 23
1720
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Ausbildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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