android原生开发视频播放

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liuxingyuzaixian/article/details/83012856

一、在线MP4视频播放地址

二、视频播放demo

三、本地视频快速加密与解密工具类

private final int REVERSE_LENGTH = 10;
    /**
     * 加解密
     *
     * @param strFile 源文件绝对路径
     * @return
     */
    private boolean encrypt(String strFile) {
        int len = REVERSE_LENGTH;
        try {
            File f = new File(strFile);
            RandomAccessFile raf = new RandomAccessFile(f, "rw");
            long totalLen = raf.length();

            if (totalLen < REVERSE_LENGTH)
                len = (int) totalLen;

            FileChannel channel = raf.getChannel();
            MappedByteBuffer buffer = channel.map(
                    FileChannel.MapMode.READ_WRITE, 0, REVERSE_LENGTH);
            byte tmp;
            for (int i = 0; i < len; ++i) {
                byte rawByte = buffer.get(i);
                tmp = (byte) (rawByte ^ i);
                buffer.put(i, tmp);
            }
            buffer.force();
            buffer.clear();
            channel.close();
            raf.close();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

demo地址:https://download.csdn.net/download/liuxingyuzaixian/10713900

猜你喜欢

转载自blog.csdn.net/liuxingyuzaixian/article/details/83012856
今日推荐