当我试图meeting通过Zuul网关到达服务时,Zuul无法将请求转发给相应的服务.以下错误是我面临的问题:
- nettflix.zuul.exception.ZuulException:转发错误
- 引起:com.netflix.client.ClientException:负载均衡器没有可用于客户端的服务器:会议
让我分享服务,eureka和zuul网关的application.yml.
EurekaClient:
Application.yml
server:
port: 8761
eureka:
instance:
hostname: localhost
lease-renewal-interval-in-seconds: 300
client:
register-with-eureka: false
fetch-registry: true
serviceUrl:
defaultZone: http://localhost:8761/eureka/
Run Code Online (Sandbox Code Playgroud)
ZuulGateWay:
application.yml
server:
port: 8085
spring:
application:
name: gatekeeper
zuul:
routes:
meeting: /meeting/**
serviceId: meeting
ribbon:
eureka:
enabled: false
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
Run Code Online (Sandbox Code Playgroud)
ZuulGateWay: SpringBootApplication
package com.sagarp.gatekeeper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy
public class MeetingApplication {
public static void main(String[] args) {
SpringApplication.run(MeetingApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
我的服务类(会议): Application.yml …
我在堆栈中找到了一些答案,确实使用了ffmpeg,但它给了我一些错误.
我在命令窗口运行它,错误很像
"无法为'ΓÇôi'ΓÇôi找到合适的输出格式:无效的参数".
我的命令如下
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=(main_w-overlay_w-10)/2:(main_h-overlay_h-10)/2 [out]" outputvideo.mp4
Run Code Online (Sandbox Code Playgroud)
请提出一些想法.
我成功融合后设置了socket.emit事件.但是当我绑定sockets.on事件时会出现问题.它被多次开除.
$(document).on('click', '#comment_button', function() {
$.ajax({
// upon success
success: function (response) {
if (response) {
socket.emit('postcomment');
socket.on('refresh', function () {
console.log('refresh');
//This console.log('refresh') is coming multiple times. I mean its occurance increases with every successful ajax response.
});
}
});
});
Run Code Online (Sandbox Code Playgroud)
这是我的server.js
socket.on('postcomment', function () {
io.sockets.emit("refresh");
});
Run Code Online (Sandbox Code Playgroud)
我已经验证在我的server.js socket.on函数中只调用了一次.我不知道socket.on('refresh', function () {}在ajax中有什么问题.任何帮助都会很棒.
PS插座连接已经完成.没问题.
编辑:我纠正了这个错误.如果有人将来读这个.正如杰森和尼兰詹提到的那样,
socket.on{}事件在成功回应时具有约束力.简单来说:每次调用click处理程序时,它都会向socket添加其他事件侦听器.您在之前点击时附加的听众仍然有效.
所以我对之前的代码进行了以下更改
$(document).on('click', '#comment_button', function() {
$.ajax({
// upon success
success: function (response) {
if (response) {
socket.emit('postcomment');
}
}); …Run Code Online (Sandbox Code Playgroud) 我想使用任何事件侦听器在视频播放时监视视频持续时间。我用于videojs视频播放。
我遇到过类似的事件play,myplayer.isPaused但它们只触发一次。
myplayer是 的视频元素videojs。现在,经过进一步研究,我得到了一个名为 的事件 on。代码如下:
myPlayer.on("play", myfun);
function myfun() {
console.log("myPlayer.currentTime()");
console.log(myPlayer.currentTime());
myfun();
}
Run Code Online (Sandbox Code Playgroud)
这是我期望它会给我的,currentTime正如你所看到的,我正在递归myfun调用。但是这个函数被调用了一百万次,但只给了我开始时间,即0。
我什至尝试放入myPlayer.currentTime(),setInterval但这种方法不值得信赖,当然也不是一个好主意。
我使用了原生 javascript 事件监听器,但它们不太可能有用。
那么有什么帮助可以为视频播放附加事件侦听器以便我获得播放持续时间吗?
angularjs ×1
ffmpeg ×1
html5-video ×1
java ×1
javascript ×1
jquery ×1
netflix-zuul ×1
node.js ×1
php ×1
sockets ×1
spring-boot ×1
video.js ×1