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

h5下audio取消监听事件错误 #393

Closed
2460392754 opened this issue May 19, 2019 · 0 comments
Closed

h5下audio取消监听事件错误 #393

2460392754 opened this issue May 19, 2019 · 0 comments
Assignees

Comments

@2460392754
Copy link

问题描述
h5下audio取消监听事件错误
例如:audio.offTimeUpdate();
控制台错误: audio.offTimeUpdate is not a function

系统信息:

  • 发行平台: H5
  • 操作系统 window
  • HBuilderX: 1.9.8.20190518

code

<template>
	<view class="content">
	</view>
</template>

<script>
import $request from '../../utils/axios.js';

export default {
	methods: {
		$_audioInit() {
			const audio = uni.createInnerAudioContext();

			audio.src = 'http://m10.music.126.net/20190519162600/07adbd9d2e4cdd24d695805c7ace0df7/ymusic/8f13/217b/f5e9/c8a4cf0af1ee87c6572ae1a3167906dc.mp3';
			audio.onCanplay(function() {
				console.log('audio onCanplay');
				audio.play();
			});

			audio.onTimeUpdate(function() {
				console.log('audio onTimeUpdate');
			});

			setTimeout(() => {
				try {
					audio.offTimeUpdate();
					console.log('audio offTimeUpdate');
				} catch (e) {
					console.error('Error audio offTimeUpdate: ' + e);
				}
			}, 2000);
		}
	},

	created() {
		this.$_audioInit();
	}
};
</script>

@zhetengbiji zhetengbiji self-assigned this May 20, 2019
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

2 participants