Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Use the video preview widget in odoo 16

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
widgetpreviewvideosolvedodoo16features
1 Odpowiedz
4931 Widoki
Awatar
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
Awatar
Odrzuć
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.

Awatar
Bhavin Patel
Najlepsza odpowiedź

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
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Video Preview Widget in Odoo 12? Rozwiązane
widget preview video odoo12 Odoo13.0
Awatar
Awatar
Awatar
Awatar
3
kwi 23
7380
How to use video preview widget in odoo 16 ?
preview odoo16features
Awatar
Awatar
2
kwi 23
4984
How to use work_permit_upload widget in Odoo16.
widget odoo16features
Awatar
Awatar
1
kwi 24
3329
(Odoo 16) widget: many2many_checkboxes need more features
xml widget odoo16features
Awatar
Awatar
1
maj 24
2855
How to see the preview of the file i import ?
import preview odoo16features
Awatar
0
lis 23
1807
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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