public static void createRemoteM3U8(File dir, M3U8 m3u8) throws IOException {
        File m3u8File = new File(dir, VideoDownloadUtils.REMOTE_M3U8);
        if (m3u8File.exists()) {
            return;
        }
        BufferedWriter bfw = new BufferedWriter(new FileWriter(m3u8File, false));
        bfw.write(M3U8Constants.PLAYLIST_HEADER + "\n");
        bfw.write(M3U8Constants.TAG_VERSION + ":" + m3u8.getVersion() + "\n");
        bfw.write(M3U8Constants.TAG_MEDIA_SEQUENCE + ":" + m3u8.getInitSequence() + "\n");
        bfw.write(M3U8Constants.TAG_TARGET_DURATION + ":" + m3u8.getTargetDuration() + "\n");
        for (M3U8Seg m3u8Ts : m3u8.getTsList()) {
            if (m3u8Ts.hasInitSegment()) {
                String initSegmentInfo;
                if (m3u8Ts.getSegmentByteRange() != null) {
                    initSegmentInfo = "URI=\"" + m3u8Ts.getInitSegmentUri() + "\"" + ",BYTERANGE=\"" + m3u8Ts.getSegmentByteRange() + "\"";
                } else {
                    initSegmentInfo = "URI=\"" + m3u8Ts.getInitSegmentUri()  + "\"";
                }
                bfw.write(M3U8Constants.TAG_INIT_SEGMENT + ":" + initSegmentInfo + "\n");
            }
            if (m3u8Ts.hasKey()) {
                if (m3u8Ts.getMethod() != null) {
                    String key = "METHOD=" + m3u8Ts.getMethod();
                    if (m3u8Ts.getKeyUri() != null) {
                        String keyUri = m3u8Ts.getKeyUri();
                        key += ",URI=\"" + keyUri + "\"";
                        HttpURLConnection connection = HttpUtils.getConnection(keyUri, null, true);
                        DataInputStream dis = new DataInputStream(connection.getInputStream());
                        File keyFile = new File(dir, m3u8Ts.getLocalKeyUri());
                        DataOutputStream dos = new DataOutputStream(new FileOutputStream(keyFile));
                        byte[] buffer = new byte[4096];
                        int count;
                        while ((count = dis.read(buffer)) > 0) {
                            dos.write(buffer, 0, count);
                        }
                        dis.close();
                        dos.close();
                        if (m3u8Ts.getKeyIV() != null) {
                            key += ",IV=" + m3u8Ts.getKeyIV();
                        }
                    }
                    bfw.write(M3U8Constants.TAG_KEY + ":" + key + "\n");
                }
            }
            if (m3u8Ts.hasDiscontinuity()) {
                bfw.write(M3U8Constants.TAG_DISCONTINUITY + "\n");
            }
            bfw.write(M3U8Constants.TAG_MEDIA_DURATION + ":" + m3u8Ts.getDuration() + ",\n");
            String byteRange = m3u8Ts.getByteRange();
            if (!TextUtils.isEmpty(byteRange)) {
                bfw.write(M3U8Constants.TAG_BYTERANGE + ":" + byteRange + "\n");
            }
            bfw.write(m3u8Ts.getUrl());
            bfw.newLine();
        }
        bfw.write(M3U8Constants.TAG_ENDLIST);
        bfw.flush();
        bfw.close();
    }
parse network M3U8 file.

@param videoUrl
@return
@throws IOException
library/src/main/java/com/jeffmony/downloader/m3u8/M3U8Utils.java