Use of video

Detailed API reference: video API

Instructions

MaixAmigo, MaixCube needs Initialize ES8374 audio decoder chip before using audio

  • Create a video object, set the volume
import video

v = video.open("/sd/badapple.avi")
v.volume(50)
  • Initialize lcd, used to play the screen
import lcd

lcd.init()
  • Create I2S to process audio objects
from Maix import GPIO, I2S

i2s = I2S(I2S.DEVICE_0)
i2s.channel_config(i2s.CHANNEL_1, I2S.TRANSMITTER, resolution=I2S.RESOLUTION_16_BIT,
                       cycles=I2S.SCLK_CYCLES_32, align_mode=I2S.RIGHT_JUSTIFYING_MODE)
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)

  • Play video
while True:
    if v.play() == 0:
        print("play end")
        break
  • Recycling objects
v.__del__()

Routine

The avi file address in the test case: badapple.avi