Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with update 7.0.1 -> 7.0.2 - mediaElement is undefined #2951

Open
SpeedPony opened this issue Feb 22, 2024 · 0 comments
Open

Bug with update 7.0.1 -> 7.0.2 - mediaElement is undefined #2951

SpeedPony opened this issue Feb 22, 2024 · 0 comments

Comments

@SpeedPony
Copy link

SpeedPony commented Feb 22, 2024

Hello,

I have an issue after updating the package from 7.0.1 to 7.0.2. Here the full trace :

ERROR TypeError: mediaElement is undefined

updateNode mediaelement-and-player.js:3834
dispatchEvent mediaelement-and-player.js:1058
create mediaelement-and-player.js:6213
changeRenderer mediaelement-and-player.js:847
setSrc mediaelement-and-player.js:958
setSrc mediaelement-and-player.js:5407
setSrc mediaelement-and-player.js:5113
setSrc streaming.service.ts:113

The issue is in the code added to 7.0.2. If I display the variable event.detail.target has no property mediaElement

 key: 'updateNode',
            value: function updateNode(event) {
                var node = void 0,
                    iframeId = void 0;
                    console.log(event.detail.target);
>>>>>>>>var mediaElement = event.detail.target.mediaElement;
                var originalNode = mediaElement.originalNode;
    
                if (event.detail.isIframe) {
                    iframeId = mediaElement.renderer.id;
                    node = mediaElement.querySelector('#' + iframeId);
                    node.style.position = 'absolute';
    
                    if (originalNode.style.maxWidth) {
                        node.style.maxWidth = originalNode.style.maxWidth;
                    }
                } else {
                    node = event.detail.target;
                }
                this.domNode = node;
                this.node = node;
            }

How to reproduce ? Here the code use in the project :

  1. Init player
this.mediaPlayer = new MediaElementPlayer(this.elementId, {
      shimScriptAccess: 'always',
      startVolume: this.mediaelementStartVolume,
      features: this.mediaelementFeatures,
      success: (mediaElement: any) => {
        mediaElement.addEventListener('hlsManifestParsed', () => {});
        mediaElement.addEventListener('canplay', () => {
          if (this.isDragging || Date.now() - this.lastEnded.getTime() < 50) {
            return;
          }
        });
        mediaElement.addEventListener('play', () => {
          this.changeSubject.next('PLAY');
        });
        mediaElement.addEventListener('emptied', (e: any) => {
          this.changeSubject.next('EMPTIED');
        });
        mediaElement.addEventListener('ended', (e: any) => {
          this.changeSubject.next('ENDED');
          this.lastEnded = new Date();
        });
        mediaElement.addEventListener('error', (e: any) => {
          this.performErrorPostConditions(e);
        });
        mediaElement.addEventListener('pause', (e: any) => {
          this.changeSubject.next('PAUSE');
        });
        mediaElement.addEventListener(
          'timeupdate',
          (e: any) => {
            this.changeTimeSubject.next({
              currentTime: mediaElement.currentTime,
              duration: mediaElement.duration,
            });
          },
          false
        );
      },
    });
  1. Call setSrc
      this.mediaPlayer.setSrc([{ src: this.streamUrl, type: this.audioType }]);
      this.mediaPlayer.load();

Is this an issue on our end or is there a bug or a usecase that does not define mediaElement on the event.detail.target ?
Where is this suppose to be initialize in the script so I can check why it does not happens.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant