Nevo
Nevo
  • 发布:2015-10-13 16:10
  • 更新:2015-10-13 16:10
  • 阅读:2165

plus.downloader.createDownload pause android手机ANR

分类:HTML5+

plus.downloader.createDownload pause android手机ANR(手机小米3),iphones无问题:

function createDownload() {  
    mDownloadTask = plus.downloader.createDownload(app.getIMGURL() + mDownloadUrl, {  
        filename: mDownloadUrl + '.mp4'  
    }, function ( d, status ) {  
        console.log("6666");  
        if ( status == 200 ) {   
            console.log( "Download success: " + d.filename );  
            if (mui.os.android) {  
                plus.runtime.openFile('_downloads/' + mDownloadUrl + '.mp4');  
            } else if (mui.os.ios){  
                var path = plus.io.convertLocalFileSystemURL( '_downloads/' + mDownloadUrl + '.mp4' );  
                ui.physical.video.innerHTML = '<video style="width:100%; height:160px;" controls="controls" src="' + path + '"></video>';  
            }  
        } else {  
             console.log( "Download failed: " + status );   
             mPerUIID.innerHTML = '下载失败';  
        }    
        mISDownloading = false;  
        mDownloadTask =null;  
    });  
    mDownloadTask.addEventListener( "statechanged", onStateChanged, false );  
    mDownloadTask.start();   
}  

function onClickDownload() {  
    mPerUIID = document.getElementById('download_per');  
    mDownloadButton = document.getElementById('download_button');  
    console.log("111");  
    console.log(mISDownloading);  
    if (true == mISDownloading && null != mDownloadTask) {  
        console.log("222");  
        mDownloadButton.style.backgroundImage = "url('../../images/x6.png')";  
        mDownloadTask.pause();  
        mISDownloading = false;  
    } else {  
        console.log("333");  
        mISDownloading= true;  
        mDownloadButton.style.backgroundImage = "url('../../images/a6w.png')";  
        if(mDownloadTask) {  
            console.log("444");  
            mDownloadTask.resume();  
        } else {  
            console.log("555");  
            createDownload();  
        }  
    }  
}
2015-10-13 16:10 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复