如何解决html5视频开始播放时如何运行功能
我正在使用离子程序构建应用程序,我想在视频开始播放时运行一个功能,例如隐藏按钮等。这是我的代码
Mockito.when(reactiveMongoTemplate.aggregate(ArgumentMatchers.any(),ArgumentMatchers.anyString(),ArgumentMatchers.<Class<FooData>>any())))
.thenReturn(Flux.just(fooData));
代码不起作用,请问该页面上的任何视频开始播放时我该如何运行该功能
解决方法
var vid = document.getElementById("myVideo");
vid.onplay = function() {
alert("The video has started to play");
};
从这里:https://www.w3schools.com/tags/av_event_play.asp
,尝试一下,#include <stdio.h>
int main(void)
{
int point_x = 0;
int point_y = 0;
const char *matches[10] = { "2:3","0:0","15:12","2:13","1:5","55:7","7:2","17:2","2:17","17:18" };
for (int i = 0; i < 10; i++)
{
// This pointer points the first character of each result
const char* match = matches[i];
// Get the pointer of ":" of this result
const char* separator = match;
while( *separator != ':' && *separator != '\0' ) separator++;
// You would need to handle error when ':' is not found but here just assumes all the results contain ":".
// To make it easy to understand prepare two pointers to point each score in a result.
const char* str_x = match;
const char* str_y = separator+1; // next character of the separator
// Convert each string to number. Because we cannot use stoi,tokenize functions
// we have to do it by ourselves.
int score_x = 0;
while( *str_x != ':'){ // until separator
score_x = score_x*10 + (*str_x - '0');
str_x++;
}
int score_y = 0;
while( *str_y != '\0'){ // until NULL
score_y = score_y*10 + (*str_y - '0');
str_y++;
}
// Now compare them and give points
if( score_x == score_y ){
point_x++;
point_y++;
}else if( score_x > score_y ){
point_x+=3;
}else{
point_y+=3;
}
}
printf("point_x=%d point_y=%d\n",point_x,point_y);
return 0;
}
返回一个承诺。
play
有关更多信息:https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。