Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 访问Nativescript中组件中的exoplayer元素_Angular_Nativescript_Exoplayer - Fatal编程技术网

Angular 访问Nativescript中组件中的exoplayer元素

Angular 访问Nativescript中组件中的exoplayer元素,angular,nativescript,exoplayer,Angular,Nativescript,Exoplayer,我正在使用Nativescript和组件,我找不到任何在组件中访问此内容的方法,例如,我想在同一页面中更改src(例如,我们有不同的质量,我们想更改src,我们应该销毁播放器并使用新的src重新初始化它),获得一些事件,如播放、错误和。。。也许还有我的自定义动作按钮 我也试过: @ViewChild(Video) private player: Video; 但它还没有定义 这是我的视图代码: <StackLayout orientation="vertical" width="100%

我正在使用Nativescript和组件,我找不到任何在组件中访问此内容的方法,例如,我想在同一页面中更改src(例如,我们有不同的质量,我们想更改src,我们应该销毁播放器并使用新的src重新初始化它),获得一些事件,如播放、错误和。。。也许还有我的自定义动作按钮

我也试过:

@ViewChild(Video)
private player: Video;
但它还没有定义

这是我的视图代码:

<StackLayout orientation="vertical" width="100%" height="100%" backgroundColor="black">
    <exoplayer *ngIf="is_loaded" id="player"
               [src]="episode.link
               playbackReady="change_player_quality"
               autoplay="true"
               height="300"
               class="exoplayer"></exoplayer>
</StackLayout>


结果是我自己发现的所以我告诉你发生了什么, 我对孩子的看法是这样的:

@ViewChild('player') player: ElementRef;
this.player.nativeElement.src = 'file.mp4';
我给视图中的播放器添加了一个标签:

<exoplayer id="player" [src]="video.link" autoplay="true" height="300" class="exoplayer" #player></exoplayer>
或摧毁:

this.player.nativeElement.destroy();
我希望它能帮助你


祝你好运

我自己发现了结果,所以我告诉你发生了什么, 我对孩子的看法是这样的:

@ViewChild('player') player: ElementRef;
this.player.nativeElement.src = 'file.mp4';
我给视图中的播放器添加了一个标签:

<exoplayer id="player" [src]="video.link" autoplay="true" height="300" class="exoplayer" #player></exoplayer>
或摧毁:

this.player.nativeElement.destroy();
我希望它能帮助你

祝你好运