apache / apache/cordova-plugin-media

this.node is undefined

Open
#243 2 comments 0 reactions 0 assignees View on GitHub
platform: browser support
Dominant language
JavaScript
Stars
391
Forks
762
PR merge metrics
No merged PRs in 30d

Description

hi,
I have used 'for loop' to define many media in order to make dynamic variable. Then i have used media.release after media was stopped. Everything have been running perfectly ( media has could play and stop). But i have got error like this..

`TypeError: this.node is undefined
Stack trace:
Media.prototype.seekTo@http://localhost:8001/plugins/cordova-plugin-media/www/browser/Media.js:148:9
Media.prototype.stop@http://localhost:8001/plugins/cordova-plugin-media/www/browser/Media.js:136:9
audioStop@http://localhost:8001/js/index.js:54:17
onDeviceReady/<@http://localhost:8001/js/index.js:48:13`

For the info the js code like this...

```javascript
var arr = ['a_A', 'a_Na', 'a_Ca'];
var obj = {};
for (let i = 0; i < arr.length; i++) {
obj[arr[i]] = new Media('/audio/' + arr[i] + '.ogg', onSuccess, onError, function (mediaStatus) {
if (mediaStatus == 4) {
this.release();
}
})
};

document.getElementById('tombol').addEventListener('click', function (e) {
e.preventDefault();
obj[arr[0]].play();
});
document.getElementById('stop').addEventListener('click', function (e) {
e.preventDefault();
audioStop();

});

function audioStop() {
for (let i = 0; i < arr.length; i++) {
obj[arr[i]].stop();
}

};

function onSuccess() {
console.log('success')
};

function onError(err) {
console.log(err)
}
```

Anybody can help?

Contributor guide

Open the contributing guide

Research direction

Reproduce the stop flow from js/index.js lines 48 and 54, then inspect Media.prototype.stop and seekTo in plugins/cordova-plugin-media/www/browser/Media.js at lines 136 and 148. Determine which lifecycle path leaves this.node undefined and document a reproducible case plus the expected behavior before considering a fix or regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.