找到你要的答案

Q:Angular - capture last frame as video poster/thumb

Q:角-捕捉最后帧视频海报/拇指

My code is very simple:

<video ng-controller="Ctrl" ng-src="scopeSRC" autoplay></video>

.controller('Ctrl', function ($scope, $timeout) {

   $scope.scopeSRC = 'a_src_url';

   $timeout(function () {
     $scope.scopeSRC = 'new_src_url';
   }, 5000);
});

Now when changing the src I see black video. What I would like to do is set the last frame of the previous src video as the thumbnail while the new src is loading.

How do you think i can achieve this?

Thanks, any help appreciated

我的代码很简单:

<video ng-controller="Ctrl" ng-src="scopeSRC" autoplay></video>

.controller('Ctrl', function ($scope, $timeout) {

   $scope.scopeSRC = 'a_src_url';

   $timeout(function () {
     $scope.scopeSRC = 'new_src_url';
   }, 5000);
});

现在改变我看见黑色视频SRC的时候。我想做的就是套上SRC视频最后一帧作为缩略图,而新的SRC加载。

你认为我能做到这一点吗?

谢谢,任何帮助赞赏

answer1: 回答1:

Instead of having 1 video element and changing the src, use 2 video elements that are layered on top of each other using z-index.

When you want to switch, pause the current video element, wait for the second video element to load (listen for the loadeddata/canplay/canplaythrough events). Then swap z-indexes so the next video element is on top and then play the second video element.

而不是1视频元素和改变src,使用2视频元素,相互层叠,用Z指数。

当你想切换,暂停当前视频元素,等待第二视频元件负载(听的loadeddata /会/ canplaythrough事件)。然后换z-indexes第二视频元素在上面再打第二视频元素。

javascript  angularjs  video  thumbnails  src