-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathng-cast.component.ts
More file actions
41 lines (32 loc) · 826 Bytes
/
ng-cast.component.ts
File metadata and controls
41 lines (32 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Component, OnInit } from '@angular/core';
import { NgCastService } from './shared/ng-cast.service';
@Component({
selector: 'ng-cast',
templateUrl: './ng-cast.component.html',
styleUrls: [
'./ng-cast.component.scss'
]
})
export class NgCastComponent implements OnInit {
castingStatus: any;
window: any;
constructor(
private ngCastService: NgCastService
) { }
ngOnInit() {
this.window = window;
let ngCastService = this.ngCastService;
this.window['__onGCastApiAvailable'] = function (isAvailable: boolean) {
if (isAvailable) {
ngCastService.initializeCastApi();
}
};
this.castingStatus = this.ngCastService.getStatus();
}
openSession() {
this.ngCastService.discoverDevices();
}
closeSession() {
this.ngCastService.stop();
}
}