Clear Filters
Clear Filters

Why does matlab stop when I use activeX?

3 views (last 30 days)
dafniz91
dafniz91 on 18 May 2016
hello,
it´s my first time using an activeX(window media player) in my GUI. so firstly I tried it in a new GUI and it works, but when I copy the code and put it in an existed GUI, matlab freezes and I have to close it forcibly.
that´s the main problem, but another issue is that in the mentioned new GUI, where I tried the activeX, there´s only a window for the activeX and a pushbutton, but whan I play the editor, appears 2 activeX...I don´t have any idea of what could be the problem. since it´s my first time using this tool, may be I´m using it in a wrong way?
MovieControl = actxcontrol('WMPlayer.OCX');
handles.activex1.URL = 'mitad.mp4';
handles.activex1.settings.volume =100;
set(MovieControl.settings,'autoStart',1);
handles.activex1.controls.play()
pause(5)
handles.activex1.controls.pause()
this is the code I´m using (in the opening function) and I want to pause a video after 5 seconds of playing. but it only plays the sound the first 5 seconds and after that appears the GUI with the video paused. if I keep the GUI opened, the video is played fine from the first second and is paused after 5 seonds, as it should do. may be these details are the cause of the main problem?
I put this code in the editor of the GUI that I truly want to use and that´s when everything freeze. I put it like this:
function VIRTUALREALITY_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to VIRTUALREALITY (see VARARGIN)
% Choose default command line output for VIRTUALREALITY
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
global background;
global elderlywalking;
global walkandcar;
global countdownVideo;
global routeVideo;
global white;
global ExmHouse;
% % library % %
white=imread('white.jpg');
ExmHouse=imread('ExmHouse.jpg');
% % for background% %
background=imread('sky.jpg');
axes(handles.screen);
set(gca,'ytick',[]);%erase Axis without deleting currentAxes
set(gca,'xtick',[]);
imshow(background);
% % % VIDEO DE BIENVENIDA Y SALUDOS % % %
% addpath(genpath('C:\Users\AIRI\OneDrive\TESIS amalia\PRUEBA PARA MATLAB'))
MovieControl = actxcontrol('WMPlayer.OCX');
handles.activex1.URL = 'mitad.mp4';
handles.activex1.settings.volume =100;
set(MovieControl.settings,'autoStart',1);
handles.activex1.controls.play()
pause(5)
handles.activex1.controls.pause()
does someone know what is happening?

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!