lido-player 0.0.2-alpha-1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -496,50 +496,28 @@ AppRandom.style = AppRandomStyle0;
496
496
  const AppRoot = class {
497
497
  constructor(hostRef) {
498
498
  index.registerInstance(this, hostRef);
499
- this.xmlPath = undefined;
500
- this.initialIndex = 0;
501
- this.canplay = true;
502
499
  this.xmlData = undefined;
503
500
  }
504
501
  /**
505
502
  * Lifecycle method that runs before the component is loaded.
506
- * It fetches the XML data from the specified path or URL and sets it to the component's state.
503
+ * It fetches the XML data from the assets folder and sets it to the component's state.
507
504
  */
508
505
  async componentWillLoad() {
509
- // Validate the xmlPath prop
510
- if (!this.xmlPath) {
511
- console.error('XML path is not provided.');
512
- return;
513
- }
514
- // Fetch the XML data
515
- try {
516
- const resolvedPath = this.xmlPath.startsWith('http')
517
- ? this.xmlPath // Use the provided URL if it's an HTTP/HTTPS link
518
- : index.getAssetPath(this.xmlPath); // Otherwise, resolve it as an asset path
519
- const response = await fetch(resolvedPath);
520
- if (!response.ok) {
521
- throw new Error(`Failed to fetch XML data: ${response.statusText}`);
522
- }
523
- const data = await response.text();
524
- // Store the XML data in the component's state
525
- this.xmlData = data;
526
- }
527
- catch (error) {
528
- console.error('Error fetching XML data:', error);
529
- this.xmlData = null;
530
- }
506
+ // Get the path to the XML file from the assets directory
507
+ const res = index.getAssetPath('./assets/xmlData.xml');
508
+ // Fetch the XML data asynchronously
509
+ const response = await fetch(res);
510
+ const data = await response.text();
511
+ // Store the XML data in the component's state
512
+ this.xmlData = data;
531
513
  }
532
514
  render() {
533
515
  // Show a loading message until the XML data is fetched
534
- if (this.xmlData === undefined) {
516
+ if (!this.xmlData) {
535
517
  return index.h("div", null, "Loading...");
536
518
  }
537
- // Show an error message if the XML data could not be fetched
538
- if (this.xmlData === null) {
539
- return index.h("div", null, "Error loading XML data. Please check the path or URL.");
540
- }
541
519
  // Once the XML data is loaded, pass it to the `app-home` component
542
- return index.h("app-home", { initialIndex: this.initialIndex, canplay: this.canplay, xmlData: this.xmlData });
520
+ return index.h("app-home", { initialIndex: 0, canplay: true, xmlData: this.xmlData });
543
521
  }
544
522
  static get assetsDirs() { return ["assets"]; }
545
523
  };