Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
26888 Lượt xem

I have got video in the backend which is saved as an attachment, now i want to display the video in the website . How can i achieve it ?

Now i am possible to display the video in the following ways , but not from the one saved as attachments.

<iframe src="//www.youtube.com/embed/vxIj3JKEGvE" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="/web_school/static/src/img/play_video.mp4"></iframe>
</div>
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi,

Got the solution like this.

Attached a video in the backend as attachment, then i accessed the the attachment from the controller and passed/ rendered the binary value of the video to the template. And in the template, added the code like this.

<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" t-att-src="'data:video/mp4;base64,' + str(video_material)"></iframe>
</div>


Thanks

Ảnh đại diện
Huỷ bỏ

how about conroller code can you please share fully code thanks in advance

I'd love to see the controller code as well. thanks.

Câu trả lời hay nhất

Dear Niyas, I am not sure !!

You attach your file to a binary field. That will be base64.

Then try to display video using base64. 

See the example

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I think this is not possible so far. Would need a new module. 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 2 24
24258
0
thg 7 18
2727
2
thg 7 18
3110
2
thg 11 17
4622
3
thg 5 23
15837