Play Video using connected USB via OTG cable in Android?

前端 未结 2 1559
一个人的身影
一个人的身影 2021-02-10 16:32

I want to ask that there are application available in which user can connect USB to Android via OTG cable device and play the media (specially videos) contained by it.

i

2条回答
  •  广开言路
    2021-02-10 17:10

    Dividing the video in multiple sub videos may work for you.

    What I suggest : instead of saving full video in one temp path, divide that video in multiple sub videos and then replaced AVPlayerItem property of AVPlayer accordingly.

    So now functionality is working same as video streaming . :)

    You can also convert the CMSampleBuffer that the AVAssetReader returns into a CGImage and then a UIImage and display that in a UIImageView, to render the frames as they are pulled out of the original video file.

    There is example code inside the AVFoundation Programming Guide that shows how to do this conversion.

提交回复
热议问题