MediaSession not supported by TypeScript 2.3.4
See original GitHub issueTypeScript Version: 2.3.4
Code
navigator.mediaSession.metadata = new MediaMetadata({
title: "Podcast Episode Title",
artist: "Podcast Host",
album: "Podcast Name",
artwork: [{src: "podcast.jpg"}]
});
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() {});
}
Expected behavior: MediaSession and MediaMetadata should be recognized by Typescript.
https://developer.mozilla.org/en-US/docs/Web/API/MediaSession https://developers.google.com/web/updates/2017/02/media-session
Actual behavior: Visual Studio Code Version 1.17.2 is showing the following Problems after saving the ts file:
message: ‘Property ‘mediaSession’ does not exist on type ‘Navigator’.’ message: ‘Cannot find name ‘MediaMetadata’.’
System information:
pablo@pablo-Inspiron-7520:~/projects/fpt3$ ionic info cli packages: (/usr/lib/node_modules)
@ionic/cli-utils : 1.13.1 ionic (Ionic CLI) : 3.13.2
global packages:
cordova (Cordova CLI) : 6.5.0
local packages:
@ionic/app-scripts : 2.1.4 Cordova Platforms : android 6.1.2 browser 4.1.0 Ionic Framework : ionic-angular 3.7.1
System:
Android SDK Tools : 25.2.5 Node : v7.10.0 npm : 3.10.10 OS : Linux 4.4
Misc:
backend : pro
As a workround I have installed @types/wicg-mediasession: https://www.npmjs.com/package/@types/wicg-mediasession
Issue Analytics
- State:
- Created 6 years ago
- Reactions:13
- Comments:10 (1 by maintainers)
Top Results From Across the Web
MediaSession not supported by TypeScript 2.3.4 · Issue #19473
Visual Studio Code Version 1.17.2 is showing the following Problems after saving the ts file: message: 'Property 'mediaSession' does not exist ...
Read more >@types/wicg-mediasession - npm
TypeScript definitions for Media Session API. Latest version: 1.1.4, last published: 3 months ago. Start using @types/wicg-mediasession in ...
Read more >How to set up TypeScript
For project types which don't support Nuget, you can use the TypeScript Visual Studio extension. You can install the extension using Extensions >...
Read more >Mastering Front-End Web Development - Tutorialspoint
Front-end web development is a science as much as an art. An accomplished front-end web developer has a profound understanding of how to...
Read more >Visual Studio 2019 Installer Only Offers TypeScript 3.3 SDK
The product I am working on uses 2.3, and while it may be upgraded to 3.3 one day it's not going to be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The “solution” is not
// @ts-ignore
but installing @types/wicg-mediasession as stated by @pablo-gonzalezI’m using it now and it’s working fantastic!
+1, this is working, the issue may be closed imo. Also add this to some docs so it is google’d better) @jsmith thank you anf Happy New Year)