In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the Mini Program BackgroundAudioManager misunderstanding is what the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe you will gain after reading this Mini Program BackgroundAudioManager misunderstanding of what article, let's take a look at it.
Several pits covered in this article (the following BAM is the abbreviation of BackgroundAudioManager)
A misunderstanding
The pit of BAM.onStop () and BAM.onEnded ()
The pit of BAM.seek () and BAM.onSeeked ()
The pit of BAM.onTimeUpdate ()
Return to the pit of Mini Program after the audio page exits Mini Program and pauses audio.
A misunderstanding
BAM.onCanplay () is an event that listens for the background audio to enter the playable state, which does not mean that the audio is in the playback state in this event.
The pit of BAM.onStop () and BAM.onEnded ()
In the callback events of BAM.onStop () and BAM.onEnded (), audio.src is empty
BAM.onStop (): when playing the audio again, assign the src of the audio in the data data to BAM, and then jump to the last paused time point within the onTimeUpdate () event (remember the local cache audio playback time oh ~)
BAM.onEnded (): in the BAM.onEnded () callback function, assign the src of the audio in the data data to BAM, and then pause the audio within the onTimeUpdate () event
The pit of BAM.seek () and BAM.onSeeked ()
Seek () expires immediately after setting src
The seek action is best placed in the BAM.onTimeUpdate event. Similar to the ontimeupdate method of the Audio element of HTML, it is recommended that all changes to currentTime be made in this method.
Jump to the specified position in the paused state. In the onSeeked () callback, the currentTime of Android is the time before the jump, while IOS is the time after the jump.
Although in the onSeeked () callback function, Android acquires the time before the currentTime jumps, if it starts playing, it still starts playing from the specified position. Therefore, if there is a need to pause continuous jumps and need to obtain currentTime, you can determine if it is Android and paused in the onSeeked () callback function.
Developer tools do not follow the onSeeked () callback
If there is a special operation in the onSeeked () callback, remember to distinguish whether it is a developer tool or not.
The pit of BAM.onTimeUpdate ()
After quitting Mini Program, neither Android nor IOS took the onTimeUpdate () event.
Therefore, if the playback time of the audio is cached in real time within the onTimeUpdate () event, the audio cache time obtained after exiting the Mini Program pause will be returned to be the time before the exit. You can record the duration of audio playback when paused in the onPause () and onEnded () events. (the actions done in the onTimeUpdate () event can be considered to reduce expenditure according to the actual situation)
Return to the pit of Mini Program after the audio page exits Mini Program and pauses audio.
IOS:BAM.src is empty
Android:BAM.src is not empty, but play () failed
This is handled in the same way as the second point. When you return after the audio page exits Mini Program to pause the audio and enters the onShow () event, assign the src of the audio in the data data to BAM, and then jump to the time point of the last pause within the onTimeUpdate () event.
This is the end of the article on "what is the misunderstanding of Mini Program BackgroundAudioManager". Thank you for reading! I believe you all have a certain understanding of the knowledge of "what is the misunderstanding of Mini Program BackgroundAudioManager". If you want to learn more knowledge, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.