安卓手机在播放视频的时候,会出现弹出默认播放器,交互十分差,可用ffmepg 将mp4视频转成ts格式,用canvas播放。
ffmepg
命令行:
默认尺寸
ffmpeg -i g:\final.mp4 -f mpegts -codec:v mpeg1video -b:v 120000k -r 1200 -bf 0 -codec:a mp2 -b:v 120000k g:\111221.ts
特定尺寸
ffmpeg -i g:\yinzi.mp4 -f mpegts -codec:v mpeg1video -s 640x1137 -b:v 120000k -r 1200 -bf 0 -codec:a mp2 -b:v 120000k g:\yinzi3.ts
-s 尺寸
-bv 视频比特率
-r 帧速率
var canvasvideo1 = document.getElementById('myCanvas');
canvasvideo1.width = cw;
canvasvideo1.height = ch;
url = 'v3.ts';
var videocccc = new JSMpeg.Player(url, { canvas: canvasvideo1, loop: false });
videocccc.play();
videocccc.pause();
videocccc.currentTime