Skip to Content
Menu
This question has been flagged
2 Replies
3945 Views

Currently i want to preview the video i uploaded using binary field. odoo 16. is there any way to do it?

Avatar
Discard
Author
i can't import video 

Vào Th 3, 4 thg 4, 2023 vào lúc 18:30 Bhavin Patel <notifications@mail.odoo.com> đã viết:
A new answer on How to use video preview widget in odoo 16 ? has been posted. Click here to access the post : See post ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​ ͏ ​

A new answer on How to use video preview widget in odoo 16 ? has been posted. Click here to access the post :

See post


Odoo S.A.

+32 81 81 37 00 | info@odoo.com | https://www.odoo.com

Powered by Odoo



--

Hoàng Ngọc Dũng
ngocdungnb06@gmail.com / 0385672944

https://www.facebook.com/Ruakhoaito 

Author Best Answer
I can't import videos

ImportError: cannot import name 'video' from 'odoo.tools' (D:\1\server\odoo\tools\__init__.py) - -
Avatar
Discard
Best Answer

In Odoo 16, you can use the video_preview widget to display a preview image and play a video. Here are the steps to use the video_preview widget in your module:

  1. Import the necessary modules:
javascript
from odoo import models, fields, api
from odoo.tools import video
  1. Define a field for the video:
python
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
  1. Add the video_preview widget to your form view:

The video_preview widget will automatically display a preview image and play the video when the user clicks on it. Note that the video field is of type Binary, and the video_preview field is computed based on the video field using the video_preview function from the odoo.tools.video module.

That's it! Now you should be able to display and play videos in your Odoo 16 module using the video_preview widget.

Avatar
Discard
Related Posts Replies Views Activity
0
Nov 23
1018
1
May 25
2105
1
Apr 25
3192
1
Apr 25
3972
1
Apr 25
1504