2012-02-06 71 views
0

我試圖通過單擊按鈕來播放.mp4。我用不同的SDK的測試此,繼承人的結果:Android上的鈦手機videoPlayer無法正常工作

1.7.5:當按下黑屏按鈕 1.8.0.1 & 1.8.1:什麼也沒有發生

該事件被註冊爲警報「測試'如果沒有註釋,它正在工作。這裏是我的代碼如下:

// Create main window 
var win = Ti.UI.createWindow({ 
    backgroundColor: '#fff' 
}); 

// Initialize the variable that will hold the playing video 
var activeVideo; 

// Create a play button 
var button = Ti.UI.createButton({ 
    title: 'Play Video', 
}); 

// Add the button to the window 
win.add(button); 

// Listen for a 'click' on the button 
button.addEventListener('click', function() { 
    // alert('Test'); 
    // Create the media player 
    activeVideo = Ti.Media.createVideoPlayer({ 
     url: 'video.mp4', 
     autoplay: true 
    }); 
}); 

// Open the window 
win.open(); 
+0

hey chris您正在將媒體播放器設置爲var activeVariable,那麼是否需要激活,.open()或設置爲可視區域或其他任何東西。我沒有在這臺機器上使用我的鈦材料,但是看起來似乎還有一步呢?你嘗試過其他視頻格式嗎?路徑是否正確? – 2012-02-08 05:49:55

回答

1

該視頻播放器未被添加到窗口。嘗試:win.add(activeVideo);