Html 角度7:设置视频currentTime始终为0

Html 角度7:设置视频currentTime始终为0,html,angular,angular7,webapi,Html,Angular,Angular7,Webapi,我想用范围输入控制视频,问题是当我将video.currentTime设置为2(例如)时,它仍然始终为0,并且该值从未更改。 这是我的angular 7代码: index.component.html <video *ngIf="product?.video" id="myVideo" width="100%" height="100%" #myVideo (l

我想用范围输入控制视频,问题是当我将video.currentTime设置为2(例如)时,它仍然始终为0,并且该值从未更改。
这是我的angular 7代码:
index.component.html

<video *ngIf="product?.video"
             id="myVideo"
             width="100%"
             height="100%"
             #myVideo
             (loadedmetadata)="onMetadata($event, myVideo)"
             (loadeddata)="pauseVideo(myVideo)"
      >
        <source [src]="serverUrl+product.video.file" type="video/mp4">
        Votre navigateur ne supporte pas le plugin des vidéos.
      </video>
...
...
<input class="range-slider__range" #slider type="range" value="0" min="0" step="1" [max]="maxDuration"
                     (input)="updateVideo(slider.value)"
              >
此外,我试图用一个可用的远程mp4视频替换url,但在localmachine中无效。 另一次尝试,是我在firefox上尝试了这段代码,它很有魅力,但在chrome上却没有

关于这个话题我搜索了很多,但仍然没有找到任何解决方案,希望你能帮助我。
提前谢谢。

尽管违反直觉,但从
中获取值将返回一个字符串,如“42”,而不是一个数字

通过在其前面添加加号,您可以轻松地将其转换为数字,如下所示:

而不是

video.currentTime = value
试一试


抱歉,我看到了此解决方案:


但我仍然无法用laravel和angular配置它。

对于所有因chrome搜索html5视频错误而遭受痛苦的人,我的解决方案如下: 在laravel中(服务器端):


在客户端,只需按照此链接了解如何请求a。

我从一开始就尝试了它,但它仍然不起作用,问题很明显,与firefox相比,chrome有一个特定的处理过程。
video.currentTime = value
video.currentTime = +value // this will convert the string to a number
/**
     * Get video BLOB format
     *
     */
    public function getVideoBlob(){
        $file_name = 'video.mp4';
        $file_contents = \Storage::disk('public')->get($videoPath);
        return response($file_contents)
            ->header('Cache-Control', 'no-cache private')
            ->header('Content-Description', 'File Transfer')
            ->header('Content-Type', 'video/mp4')
            ->header('Content-length', strlen($file_contents))
            ->header('Content-Disposition', 'attachment; filename=' . $file_name)
            ->header('Content-Transfer-Encoding', 'binary');
    }