-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
87 lines (78 loc) · 3.15 KB
/
script.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
async function fetchData() {
const res = await fetch("https://api.coronavirus.data.gov.uk/v1/data");
const record = await res.json();
document.getElementById("date").innerHTML = record.data[0].date;
document.getElementById("areaName").innerHTML = record.data[0].areaName;
document.getElementById("latestBy").innerHTML = record.data[0].latestBy;
document.getElementById("deathNew").innerHTML = record.data[0].deathNew;
}
fetchData();
document.addEventListener("DOMContentLoaded", function () {
var a = document.getElementById("a");
var d = document.getElementById("text");
// onClick's logic below:
a.addEventListener("click", function () {
if ("mediaSession" in navigator) {
console.log(navigator.mediaSession)
d.innerHTML = navigator.mediaSession.metadata
// navigator.mediaSession.metadata = new MediaMetadata({
// title: "Never Gonna Give You Up",
// artist: "Rick Astley",
// album: "Whenever You Need Somebody",
// artwork: [
// {
// src: "https://dummyimage.com/96x96",
// sizes: "96x96",
// type: "image/png",
// },
// {
// src: "https://dummyimage.com/128x128",
// sizes: "128x128",
// type: "image/png",
// },
// {
// src: "https://dummyimage.com/192x192",
// sizes: "192x192",
// type: "image/png",
// },
// {
// src: "https://dummyimage.com/256x256",
// sizes: "256x256",
// type: "image/png",
// },
// {
// src: "https://dummyimage.com/384x384",
// sizes: "384x384",
// type: "image/png",
// },
// {
// src: "https://dummyimage.com/512x512",
// sizes: "512x512",
// type: "image/png",
// },
// ],
// });
}
});
});
// if ('mediaSession' in navigator) {
// navigator.mediaSession.metadata = new MediaMetadata({
// title: 'Never Gonna Give You Up',
// artist: 'Rick Astley',
// album: 'Whenever You Need Somebody',
// artwork: [
// { src: 'https://dummyimage.com/96x96', sizes: '96x96', type: 'image/png' },
// { src: 'https://dummyimage.com/128x128', sizes: '128x128', type: 'image/png' },
// { src: 'https://dummyimage.com/192x192', sizes: '192x192', type: 'image/png' },
// { src: 'https://dummyimage.com/256x256', sizes: '256x256', type: 'image/png' },
// { src: 'https://dummyimage.com/384x384', sizes: '384x384', type: 'image/png' },
// { src: 'https://dummyimage.com/512x512', sizes: '512x512', type: 'image/png' },
// ]
// });
// navigator.mediaSession.setActionHandler('play', function() {});
// navigator.mediaSession.setActionHandler('pause', function() {});
// navigator.mediaSession.setActionHandler('seekbackward', function() {});
// navigator.mediaSession.setActionHandler('seekforward', function() {});
// navigator.mediaSession.setActionHandler('previoustrack', function() {});
// navigator.mediaSession.setActionHandler('nexttrack', function() {});
// }