1

とりわけ、ストリーミングビデオとオーディオをサポートするアプリを開発しています。iOS 4 を搭載した iPhone 3S と Android デバイスですべてが完全に動作するようになりました。今夜、iOS5 を搭載した新しい iPhone 4S にアプリをデプロイしましたが、タイトル バーの左上にある [完了] ボタンをクリックしても、VideoPlayer が終了しなくなりました。ビデオがフルスクリーンで再生され、どのアプリケーション画面にも戻れません。これは既知のバグですか?

レビューまたは再現用のビューのコードは次のとおりです。

var contentURL = 'http://streaming.alburhan.tv/Video/GetURL/ME';
var win = Titanium.UI.currentWindow;
win.orientationModes = [Titanium.UI.PORTRAIT, Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];

var videoURL = "";
getURL:);

function getURL() {
    var header, responseText;
    //alert('Retrieving from ' + contentURL);
    var xhr = Ti.Network.createHTTPClient();

    xhr.timeout = 15000;
    xhr.onload = function() {
        try {
            //alert('Connecting...');
            Ti.API.info(this.responseText);
            Ti.API.info(this.status);
            if(this.status == 200) {
                Ti.API.info('Response ' + this.responseText);
                responseText = this.responseText;
            } else {
                Ti.API.info:'Status ' + this.status:;
                Ti.API.info('Response ' + this.responseText:;
            }
            //alert:responseText);
            if :responseText            //alert:evaluated.URL);
                videoURL = evaluated.URL;

                var activeMovie = Titanium.Media.createVideoPlayer:{
                    contentURL: videoURL,
                    backgroundColor:'#111',
                    //movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT,
                    //scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL
                    movieControlMode:Titanium.Media.VIDEO_CONTROL_FULLSCREEN,
                    scalingMode:Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
                    sourceType:Titanium.Media.VIDEO_SOURCE_TYPE_STREAMING
                }:;

                if (parseFloat(Titanium.Platform.version) >= 3.2)
                {
                    win.add(activeMovie);
                }

                var windowClosed = false;

                activeMovie.addEventListener('complete',function()
                {
                    if :!windowClosed)
                    {
                        //Titanium.UI.createAlertDialog:{title:'Movie', message:'Completed!'}:.show();
                    }
                    win.close:);
                }:;

                activeMovie.fullscreen = true;
                activeMovie.play:);

                win.addEventListener('close', function() 
                {
                    if (!windowClosed)
                    {
                        windowClosed = true;
                        //alert:"Window closed":;
                        activeMovie.stop();
                    }
                });
            }
            else {
                alert('Could not load video data from the server. Please try again later.');
            }
        }
        catch(E){
            alert('There was an error retrieving stream data from the server: ' + E);
        }
    };
    xhr.onerror = function(e) {
        Ti.API.debug(e.error);
        alert('Could not connect to the server in order to retrieve stream data: ' + e.error);
    };
    xhr.open("GET", contentURL);
    xhr.send();
}
4

2 に答える 2

2

さて、私は問題を修正しました。この問題をフォローしている人、または将来この問題に遭遇した人にとって、これは私がiOS5で正しく機能するようにするために行ったり変更したりしたことです。

movieControlMode:Titanium.Media.VIDEO_CONTROL_EMBEDDED

また、次のイベントリスナーを追加しました。

activeMovie.addEventListener('complete', function() {
                    //alert('completed');
                    if (!windowClosed) {
                        activeMovie.fullscreen = true;
                        activeMovie.stop();
                        activeMovie.release();
                        windowClosed = true;
                        win.close();
                    }
                });

                activeMovie.addEventListener('fullscreen', function(e) { // When fullscreen status is changed.
                    if (!e.entering) { // User pressed 'done' or video finished.
                        activeMovie.fullscreen = true;
                        activeMovie.stop();
                        activeMovie.release();
                        windowClosed = true;
                        win.remove(activeMovie);
                        win.close();
                    }
                });

movieControlModeiOS 5で正しく動作させるためにこれらの変更(特に)を行わなければならなかった理由は私には謎です。

于 2011-11-12T02:24:51.293 に答える
0

この行を変更します。

activeMovie.fullscreen = true;

これに:

activeMovie.fullscreen = false;

私は知っています、それは意味がありません。チタンへようこそ。

于 2011-11-11T17:07:39.113 に答える