|
@@ -11,6 +11,7 @@ import { TransposeCalculator } from '../src/Plugins/Transpose/TransposeCalculato
|
|
|
var openSheetMusicDisplay;
|
|
|
var sampleFolder = "",
|
|
|
samples = {
|
|
|
+ "playerdemo.musicxml": "playerdemo.musicxml",
|
|
|
"Beethoven, L.v. - An die ferne Geliebte": "Beethoven_AnDieFerneGeliebte.xml",
|
|
|
"Clementi, M. - Sonatina Op.36 No.1 Pt.1": "MuzioClementi_SonatinaOpus36No1_Part1.xml",
|
|
|
"Clementi, M. - Sonatina Op.36 No.1 Pt.2": "MuzioClementi_SonatinaOpus36No1_Part2.xml",
|
|
@@ -110,6 +111,7 @@ import { TransposeCalculator } from '../src/Plugins/Transpose/TransposeCalculato
|
|
|
performanceModeBtn,
|
|
|
playbackControlsButton,
|
|
|
playbackControl;
|
|
|
+ //unmuteButton;
|
|
|
|
|
|
// manage option setting and resetting for specific samples, e.g. in the autobeam sample autobeam is set to true, otherwise reset to previous state
|
|
|
// TODO design a more elegant option state saving & restoring system, though that requires saving the options state in OSMD
|
|
@@ -136,7 +138,25 @@ import { TransposeCalculator } from '../src/Plugins/Transpose/TransposeCalculato
|
|
|
var showHeader = true;
|
|
|
var showDebugControls = false;
|
|
|
|
|
|
- document.title = "OpenSheetMusicDisplay Demo";
|
|
|
+ document.title = "OSMD Audio Player Demo";
|
|
|
+
|
|
|
+ function iOSDetected() {
|
|
|
+ // according to https://stackoverflow.com/a/9039885/10295942
|
|
|
+ return [
|
|
|
+ 'iPad Simulator',
|
|
|
+ 'iPhone Simulator',
|
|
|
+ 'iPod Simulator',
|
|
|
+ 'iPad',
|
|
|
+ 'iPhone',
|
|
|
+ 'iPod'
|
|
|
+ ].includes(navigator.platform)
|
|
|
+ // note that .platform was apparently only accidentally marked deprecated,
|
|
|
+ // see https://stackoverflow.com/a/47599911/10295942
|
|
|
+ // iPad on iOS 13 detection
|
|
|
+ || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
|
|
|
+ // note that some people recommend just checking userAgent instead of platform, but
|
|
|
+ // "userAgent gives false positives because some vendors fake it to mimic Apple devices for whatever reasons"
|
|
|
+ }
|
|
|
|
|
|
// Initialization code
|
|
|
function init() {
|
|
@@ -262,7 +282,8 @@ import { TransposeCalculator } from '../src/Plugins/Transpose/TransposeCalculato
|
|
|
printPdfBtns.push(document.getElementById("print-pdf-btn-optional"));
|
|
|
transpose = document.getElementById('transpose');
|
|
|
transposeBtn = document.getElementById('transpose-btn');
|
|
|
- playbackControlsButton = document.getElementById("playback-settings-button")
|
|
|
+ playbackControlsButton = document.getElementById("playback-settings-button");
|
|
|
+ // unmuteButton = document.getElementById("unmute-button");
|
|
|
|
|
|
//var defaultDisplayVisibleValue = "block"; // TODO in some browsers flow could be the better/default value
|
|
|
var defaultVisibilityValue = "visible";
|
|
@@ -801,7 +822,11 @@ import { TransposeCalculator } from '../src/Plugins/Transpose/TransposeCalculato
|
|
|
selectSample.removeChild(custom);
|
|
|
}
|
|
|
|
|
|
- playbackControl.initialize();
|
|
|
+ if (openSheetMusicDisplay.Sheet) {
|
|
|
+ playbackControl.initialize();
|
|
|
+ } else {
|
|
|
+ console.warn("Sheet couldn't be loaded, so playback control can't be initialized");
|
|
|
+ }
|
|
|
|
|
|
// Enable controls again
|
|
|
enable();
|