我正在尝试通过单击按钮来播放 .mp4。我已经使用不同的 SDK 对此进行了测试,结果如下:
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();