我正在使用Gnonlin播放2个视频.有一刻,我想暂停一个视频并运行另一个视频.但是,我不想手动暂停管道,因为另一个视频也将被暂停.
例如:
self.video[0].set_property("location", LOCATION_VIDEO1)
self.video[0].set_property("start", 0 * gst.SECOND)
self.video[0].set_property("duration", 5 * gst.SECOND)
self.video[0].set_property("media-start", 0 * gst.SECOND)
self.video[0].set_property("media-duration", 5 * gst.SECOND)
Run Code Online (Sandbox Code Playgroud)
此视频运行5秒钟.我该怎么做才能在接下来的5秒内暂停或停止播放此视频?有没有办法显示相同的帧5秒?
目标:绘制图形(x,y)并在图形上移动垂直线到计时器.
我开始使用matplotlib实现这一点.它可以使用matplotlib的draw()功能来实现它,但是它每次都会重新绘制,并且不允许我与图形交互.所以我决定使用matplotlib的动画功能.在未来,我还想暂停移动线.所以我不能使用matplotlib.animation.FuncAnimatin
问题:我使用canvas.copy_from_bbox(ax.bbox),ax.draw_artist(line),canvas.blit(ax.bbox).但是,我无法将图形存储在背景中并在其上移动一条线.当我尝试存储时,它会以一种非常奇怪的方式覆盖.
这是我建立的代码.有人可以帮帮我吗?提前致谢.
import sys
import matplotlib.pyplot as p
import time
fig=p.figure();
ax = fig.add_subplot(1,1,1)
y=[];x=[];y1=[0,1000];x1=[0,0]
y=numpy.random.randn(1000,1)*100
x=numpy.arange(0,1000)
line1, = ax.plot(x,y,color='black');
ax.set_ylim(0, 1000);
line, = ax.plot(x1,y1,color='r',alpha=1,animated=True); # this is the line which i wanted to move over the graph w.r.t to time. ( i can also use axvline , but i guess its the same).
canvas = ax.figure.canvas
canvas.draw()
background = canvas.copy_from_bbox(ax.bbox); #my problem is here
starttime=time.time();
mytimer=0;
mytimer_ref=0;
def update(canvas,line,ax):
canvas.restore_region(background) #my problem is here
t=time.time()-starttime;
mytimer=t+mytimer_ref;
x1=[mytimer,mytimer]; …Run Code Online (Sandbox Code Playgroud) 我在html5边缘动画中遇到问题.我使用边缘动画创建了一个动画.我想从外面打电话给作曲准备边缘动画.我尝试使用$.Edge.registerCompositionReadyHandler( compId, handlerFn, options ),但它给了错误ReferenceError: $ is not defined.我无法解决这个问题,但我没有找到足够的文档.谁能帮帮我吗.
我的代码看起来像这样
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<title>Untitled</title>
<!--Adobe Edge Runtime-->
<script type="text/javascript" charset="utf-8" src="teste1_edgePreload.js"></script>
<script type="text/javascript" src="teste1_resize.js"></script>
<style>
.edgeLoad-EDGE-1429726 { visibility:hidden; }
</style>
<!--Adobe Edge Runtime End-->
<script>
$.Edge.registerCompositionReadyHandler("EDGE-1429726",scaleStage) //SCALE STAGE IS INSIDE THE JAVASCRIPT fn teste1_resize.js
function mover(){
var stage = $.Edge.getComposition("EDGE-1429726").getStage();
console.log($("#Stage").height());
stage.mover();
}
</script>
</head>
<body style="margin:0;padding:0;">
<div id="Stage" class="EDGE-1429726">
<input type="button" value="Mover" onClick="mover();">
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
提前致谢