import'@sad-systems/a-tracktor/css/media-player.css'; // Use defaults media player and list CSS styles. // Also you can use SCSS styles from: // '@sad-systems/a-tracktor/styles/media-player.scss'. import { MediaPlayer, FrequencyAnalyzer } from'@sad-systems/a-tracktor';
constmediaPlayer = newMediaPlayer(MEDIA_SOURCE1, { poster:MEDIA_POSTER1, viewElement:'.media-player', // Find existed DOM element by CSS selector. analyzerOptions: { color:'#f00' }, // Set color of audio analyzer. });
// Just to debug: change the media in 5 seconds. setTimeout(() => { console.log('Change media source'); mediaPlayer.setMediaSource(MEDIA_SOURCE2); mediaPlayer.setPoster(MEDIA_POSTER2); }, 5000);
Case 2. With auto created view element and manually added to web page.