簡體   English   中英

最后使用MOOV atom的mp4文件的Android視頻流

[英]Android video streaming of mp4 files with MOOV atom at the end

我已經實現了一個流式視頻播放器,它可以使用VideoView和asynctask在Android中流式傳輸包括mp4在內的視頻格式。 然而,有些視頻從一開始就順利播放,而有些視頻直到完全下載才開始播放。

根據我的研究,我發現moov atom(如TOC)保存在文件末尾的mp4文件正在以這種方式運行。

我見過一個可以解決這個問題的庫。

compile 'net.ypresto.qtfaststartjava:qtfaststart:0.1.0'

但是我沒有得到關於如何將這個庫集成到我的項目的任何參考。 請發布一些參考或片段來實現此庫以解決我的問題。

    File input = new File(path + "/input.mp4"); // Your input file
    File output = new File(path + "/output.mp4"); // Your output file
    try{
        if(!output.exists()) // if there is no output file we'll create one
            output.createNewFile();
        }
    }catch (IOException e){
        Log.e("TAG", e.toString());
    }

    try{
        QtFastStart.fastStart(input, output);
    }catch (QtFastStart.MalformedFileException m){
        Log.e("QT", m.toString());
    }catch (QtFastStart.UnsupportedFileException q){
        Log.e("QT", q.toString());
    }catch (IOException i){
        Log.e("QT", i.toString());
    }

這就是全部

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM