refactor: Remove nested Promise

This commit is contained in:
Dmitry Lyzo 2022-02-26 13:56:50 +03:00
parent 270430f6a1
commit bde869ecb2

View File

@ -39,16 +39,12 @@ class PlaybackPermissionManager {
return Promise.resolve(true);
}
return new Promise((resolve, reject) => {
const media = createTestMediaElement();
media.play().then(() => {
resolve();
}).catch((error) => {
reject(error);
}).finally(() => {
return media.play()
.finally(() => {
destroyTestMediaElement(media);
});
});
}
}