2894| 8
|
[问题求助] maix dock 如何循环播放视频?(已解决) |
本帖最后由 empty 于 2021-4-5 20:06 编辑 第一次播放是正常的,播放结束后回到视频第一帧然后卡住。 代码如图,我把视频对象删除(_del_),后再open,也不行。怀疑是内存没释放,然后加了gc,还是不行。 完整代码: from Maix import GPIO, I2S #import sys import gc from fpioa_manager import fm import lcd import video import time lcd.init() # AUDIO_PA_EN_PIN = None # Bit Dock and old MaixGo AUDIO_PA_EN_PIN = 32 # Maix Go(version 2.20) # AUDIO_PA_EN_PIN = 2 # Maixduino '''''' # init i2s(i2s0) i2s = I2S(I2S.DEVICE_0) # config i2s according to audio info i2s.channel_config(i2s.CHANNEL_1, I2S.TRANSMITTER, resolution=I2S.RESOLUTION_16_BIT, cycles=I2S.SCLK_CYCLES_32, align_mode=I2S.RIGHT_JUSTIFYING_MODE) # open audio PA if AUDIO_PA_EN_PIN: fm.register(AUDIO_PA_EN_PIN, fm.fpioa.GPIO1, force=True) wifi_en = GPIO(GPIO.GPIO1, GPIO.OUT) wifi_en.value(1) fm.register(34, fm.fpioa.I2S0_OUT_D1, force=True) fm.register(35, fm.fpioa.I2S0_SCLK, force=True) fm.register(33, fm.fpioa.I2S0_WS, force=True) v = video.open("/sd/2.avi") print(v) v.volume(50) while True: if v.play() == 0: print("play end") v.__del__() gc.collect() v = video.open("/sd/2.avi") #break v.__del__() |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed