2012-02-06 72 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);