nHow to do you add Firefox Media to Libreoffice? This Is My 1st Post So Pls Direct Me To The Correct List
Philip C
limasila0 at gmail.com
Sat Mar 6 10:39:44 UTC 2021
LibreOffice Developers
This my first time posting so please direct me to the most appropiate list
Pls can someone tell me how to take the code from firefox that handles
video and audio media and insert it into Libreoffice? Someone did suggest
that in 2011 but I do not know if that was done.
Or get Firefox to access a Libreoffice file directly.
Firefox can play videos and media with a progress bar etc - there is also a
vlc extension for firefox.
While Lireoffice has good ideas and features eg everything in a single file
and toc.
Due to the scale of my project the subdocuments are generated using perl.
Most of what is required is done or acheivable except for the video / audio
media section.
A html version can already be generated but it produces lots of picture and
media files.
How do you put video and audio in a odt file? After all it is another
draw:frame just like an image or text box.
In the impress route you have to add autostart and still there is no
autostop or pause bar.
In openoffice::oodoc::text you can add in an image as well as text.
Is there a way using openoffice::oodoc::xpath to simply generate the xml
code required. This technique is already being used in my project to add in
images, text boxes, toc etc.
For example
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use OpenOffice::OODoc;
use OpenOffice::OODoc::XPath;
# open the document container
my $cont = odfContainer("/path/to/ExistingTemplateFile.odt");
# set up the doc variable
my $doc = odfDocument(
"container" => $cont,
"part" => 'content');
# set up song file and member parameters
my $song = "MySong.webm";
my $songfile = "/path/to/".$song;
my $member = "Media/".$song;
my $wdth = 640;
my $hght = 400;
my $gx = 0;
my $gy = 0;
# see reference manual on command line with man or via google from CPAN
# man openoffice::oodoc::xpath
$doc->appendBodyElement( $doc->createElement (
'<draw:frame draw:layer="layout" '.
'draw:style-name="standard" '.
'svg:height="'.&frmtcm(&px2cm($hght)).'cm" '.
'svg:width="'.&frmtcm(&px2cm($wdth)).'cm" '.
'svg:x="'.&frmtcm(&px2cm($gx)).'cm" '.
'svg:y="'.&frmtcm(&px2cm($gy).'cm">
<draw:plugin '.
'draw:mime-type="application/vnd.sun.star.media" '.
'xlink:actuate="onLoad" '.
'xlink:href="'.$member.'" '.
'xlink:show="embed" '.
'xlink:type="simple">
<draw:param draw:name="Loop" draw:value="false"/>
<draw:param draw:name="Mute" draw:value="false"/>
<draw:param draw:name="VolumeDB" draw:value="0"/>
</draw:plugin>
</draw:frame>
'));
# Load the songfile into the Media section of the odt
$doc->raw_import($member, $songfile);
# Save The Updated odt
$doc->save("/path/to/UpdatedFile.odt");
sub frmtcm {
my $x = shift;
if (defined($x)) {
my $y = sprintf ("%7.3f", $x);
$y =~ s/^ *//g;
return $y;
} else {
return 0;
}
}
sub px2cm {
return $_[0] * 2.54 / 96;
}
Or as an alternative can Firefox other browser which can handle xml be made
to access the video from the odt file and the browser be accessed using
imbeded html object. This html works fine on a stand alone video src file
but does not extract the song from an odt yet. How to fix this?
<html>
<head>
<title>MySong Video</title>
</head>
<body>
<video width="640" height="400" controls="1">
<source src="file:///path/to/my.odt#Media/MySong.webm" type="video/webm">
Your browser does not support the video tag.
</video>
</body>
</html>
Thank you for your attention to my question.
Regards
Philip
My Lenova laptop runs Fedora 33
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20210306/ee171476/attachment.htm>
More information about the LibreOffice
mailing list