编程方式嵌入视频的Apache开放式办公API [英] Programatically embed video Apache Open Office API

查看:231
本文介绍了编程方式嵌入视频的Apache开放式办公API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个插件,通过自动指定视频的位置增加了在开放式办公即时通讯preSS的开放实例当前幻灯片的视频。到目前为止,我已经使用了code做修改这是我使用插入的形状和其他演示检查的Docment。但我不能找到一种方法来嵌入视频。调用 .uno:InsertAVMedia 打开一个文件选择对话框。我想通过JAVA来指定文件的位置

  XPropertySet道具= UnoRuntime.queryInterface(XPropertySet.class,oDesktop);
   prop.setPropertyValue(URL,E:\\ rec.avi);
   为PropertyValue文件=新为PropertyValue();
   file.Name =文件名;
   file.Value =文件:///test.jpg;
    为PropertyValue链接=新为PropertyValue();
   link.Name =AsLink;
   link.Value = FALSE;
    为PropertyValue [] =支撑{文件,链接};
   DispatchResultEvent DRE =(DispatchResultEvent)helper.executeDispatch(xDispatchProvider.uno:InsertVideo,,0,丙);helper.executeDispatch(xDispatchProvider,.uno:的OpenURL,E:\\ rec.avi,0,NULL);


解决方案

有可能增加一个<一个href=\"https://www.openoffice.org/api/docs/common/ref/com/sun/star/media/XPlayer.html#createPlayerWindow\"相对=nofollow> XPlayer 在当前幻灯片。它看起来像这将允许你播放视频,并且可以自动指定文件的URL。

下面是一个使用的createPlayer 一个例子:的 https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=57699

修改

这基本code ++工程,我的系统上。要播放视频,只需调用程序。

 子play_video
    如果Video_flag = 0则
        视频= converttoURL(_
            C:\\用户\\ JimStandard \\下载\\ H264_test1_Talkinghead_avi_480x360.avi)
        Video_flag = 1
        '对于Windows:
        oManager = CreateUnoService(com.sun.star.media.Manager_DirectX)
        适用于Linux
        oManager = CreateUnoService(com.sun.star.media.Manager_GStreamer)
        OPLAYER = oManager.createPlayer(视频)
        oPlayer.CreatePlayerwindow(阵列())'崩溃?
        oPlayer.setRate(1.1)
        oPlayer.setPlaybackLoop(假)
        oPlayer.setMediaTime(0.0)
        oPlayer.setVolumeDB(GetSoundVolume())
        oPlayer.start()讲座
        Player_flag = 1
    其他
        oPlayer.start()讲座
        Player_flag = 1
    万一
结束小组

I want to create a plugin that adds a video on the current slide in an open instance of Open Office Impress by specifying the location of the video automatically. The code I have used so far does modify the docment which I have checked using Insert shapes and other demos. But I cannot find a way to embed a video. calling .uno:InsertAVMedia a file chooser dialog opens. I want to specify the location of the file through JAVA

    XPropertySet prop= UnoRuntime.queryInterface(XPropertySet.class, oDesktop);
   prop.setPropertyValue("URL", "E:\rec.avi");
   PropertyValue file=new PropertyValue();
   file.Name="FileName";
   file.Value="file:///test.jpg";
    PropertyValue link=new PropertyValue();
   link.Name="AsLink";
   link.Value=false;
    PropertyValue[] prop={file,link};
   DispatchResultEvent dRE = (DispatchResultEvent) helper.executeDispatch(xDispatchProvider , ".uno:InsertVideo", "", 0, prop);

helper.executeDispatch(xDispatchProvider, ".uno:OpenUrl", "E:\rec.avi", 0,null);

解决方案

It is possible to add an XPlayer on the current slide. It looks like this will allow you to play a video, and you can specify the file's URL automatically.

Here is an example using createPlayer: https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=57699.

EDIT:

This Basic code works on my system. To play the video, simply call the routine.

sub play_video
    If Video_flag = 0 Then
        video =converttoURL( _
            "C:\Users\JimStandard\Downloads\H264_test1_Talkinghead_avi_480x360.avi")
        Video_flag = 1
        'for windows:
        oManager = CreateUnoService("com.sun.star.media.Manager_DirectX")
        ' for Linux
        ' oManager = CreateUnoService("com.sun.star.media.Manager_GStreamer")
        oPlayer = oManager.createPlayer( video )
        ' oPlayer.CreatePlayerwindow(array()) ' crashes?
        'oPlayer.setRate(1.1)
        oPlayer.setPlaybackLoop(False)
        oPlayer.setMediaTime(0.0)
        oPlayer.setVolumeDB(GetSoundVolume())
        oPlayer.start() ' Lecture
        Player_flag = 1
    Else
        oPlayer.start() ' Lecture
        Player_flag = 1
    End If
End Sub

这篇关于编程方式嵌入视频的Apache开放式办公API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆