[uniapp] uniapp develops Android switching video link app crash problem

Lower versions of Android systems may have a black screen or crash when switching video links.

Generally, systems below Android 8

I developed it on a projector, and the system is older, only 5.7, so there is a crash problem.

There are two ways to try to solve it

Method 1: Add codec="software" to the video tag

Decoder selection, hardware: hard decoding (hard decoding can increase decoding power and improve video clarity. A small number of old hardware may have compatibility issues); software: ffmpeg soft decoding;

If it still doesn’t work, add http-cache=false [This can mainly solve some problems of black screen and unable to load]

Whether to enable local caching for http and https video sources. Cache strategy: Video sources with this switch turned on will save cache files locally during video playback. If the local cache pool exceeds 100M, the previous cache will be cleared before caching (not applicable to streaming media protocols such as m3u8)

<video codec="software" :http-cache='cache' style="width:100%; height: 100%;" :src="imgSrc" controls enable-play-gesture show-casting-button autoplay ></video>

Method 2: If the above method really doesn’t work, you can try it (not recommended)

Just use v-if to control the video, hide the video before switching, and then release the video after switching the link. This can also solve this problem.

But we all know that v-if frequently causes components to appear and disappear structurally, so it is not recommended to use this method.

Guess you like

Origin blog.csdn.net/wuguidian1114/article/details/124516643