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

fix: remove el on sendOutput #49

Merged
merged 1 commit into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build/can-autoplay.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ function startPlayback(_ref, elementCallback) {
sendOutput = function sendOutput(result) {
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

// Clean up to avoid MediaElementLeak
element.remove();
element.srcObject = null;

clearTimeout(timeoutId);
resolve({ result: result, error: error });
};
Expand Down
4 changes: 4 additions & 0 deletions build/can-autoplay.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ function startPlayback(_ref, elementCallback) {
sendOutput = function sendOutput(result) {
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

// Clean up to avoid MediaElementLeak
element.remove();
element.srcObject = null;

clearTimeout(timeoutId);
resolve({ result: result, error: error });
};
Expand Down
4 changes: 4 additions & 0 deletions build/can-autoplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ function startPlayback(_ref, elementCallback) {
sendOutput = function sendOutput(result) {
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

// Clean up to avoid MediaElementLeak
element.remove();
element.srcObject = null;

clearTimeout(timeoutId);
resolve({ result: result, error: error });
};
Expand Down
7 changes: 4 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function startPlayback ({muted, timeout, inline}, elementCallback) {
sendOutput(false, new Error(`Timeout ${timeout} ms has been reached`))
}, timeout)
sendOutput = (result, error = null) => {
// Clean up to avoid MediaElementLeak
element.remove()
element.srcObject = null

clearTimeout(timeoutId)
resolve({result, error})
}
Expand All @@ -44,9 +48,6 @@ function startPlayback ({muted, timeout, inline}, elementCallback) {
} else {
sendOutput(true)
}
// Clean up to avoid MediaElementLeak
element.remove()
element.srcObject = null
})
}

Expand Down