Solved Play video when a dialog window opens
#1
Image

Do you guys know how I can start a video/trailer on a videowindow implemented on a custom dialog window.
On the example, if there is a trailer, instead of showing the MAME logo image, I created a videowindow. But how can I trigger the video to play when I open the info window (<oninfo>ActivateWindow(1128)</oninfo>)

Hope you guys can help me
Thanks for the help in advance
Reply
#2
Use onload in the dialog.
Reply
#3
(2017-01-21, 22:48)Hitcher Wrote: Use onload in the dialog.
I already tried that, but don't know if I was doing something wrong. I will try again

EDIT
it doesn't work
Code that I'm using.
PHP Code:
    <control type="videowindow">
                <
left>232</left>
                <
top>260</top>
                <
width>185</width>
                <
height>185</height>
    </
control>

<
onload>PlayMedia($INFO[ListItem.trailer],1)</onload

EDIT 2
I put this code right after the <window id="1128" type="dialog"> and the video plays, the problem is that plays on the window and on the background (kodi main player)
Reply
#4
I don't know if it matter but onload normally is on top of the page before the controls section also...Maybe my ignorance but in playmedia infolistem.trailer why do you have the ,1? Is that needed.
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#5
Then what you have done is correct for edit 2 by the sounds of it, the issue sounds like there are two videowindows, the one you created, and one that is part of the skin which will be fullscreen in size. When the video plays, because both videowindows are "visible" the video plays in both.

EDIT: Again, I'm not sure where this videowindow is located because I don't use the skin and admittedly, I didn't look through your files this time to see if it was there. But there would be some likely places to check first to narrow down where it is being used. First, check your window to see if there is an include or something that alludes to it, more than likely it will sit in the MyPrograms.xml I guess. All you need to do is a set a condition that this is visible when it isn't your special window.

EDIT2: And as smitchell6879 says, normally you'd have the onload conditions at the start of the xml before your controls.
Reply
#6
(2017-01-22, 00:45)smitchell6879 Wrote: I don't know if it matter but onload normally is on top of the page before the controls section also...Maybe my ignorance but in playmedia infolistem.trailer why do you have the ,1? Is that needed.
You are righ, onload works on the top of the page

On the wiki
Plays the media. This can be a playlist, music, or video file, directory, plugin or a url. The optional parameter ",isdir" can be used for playing a directory. ",1" will start a video in a preview window, instead of fullscreen. If media is a playlist, you can use playoffset=xx where xx is the position to start playback from.

(2017-01-22, 01:19)Rufoo Wrote: Then what you have done is correct for edit 2 by the sounds of it, the issue sounds like there are two videowindows, the one you created, and one that is part of the skin which will be fullscreen in size. When the video plays, because both videowindows are "visible" the video plays in both.

EDIT: Again, I'm not sure where this videowindow is located because I don't use the skin and admittedly, I didn't look through your files this time to see if it was there. But there would be some likely places to check first to narrow down where it is being used. First, check your window to see if there is an include or something that alludes to it, more than likely it will sit in the MyPrograms.xml I guess. All you need to do is a set a condition that this is visible when it isn't your special window.

EDIT2: And as smitchell6879 says, normally you'd have the onload conditions at the start of the xml before your controls.
I tested a view that I made before that just played the video in the window that I made, and now it plays on the background too.
Don't know what is happening. I will se if its the changes that I made on the furniture or animation files

Thanks for the help

EDIT
I guess I tested that view with the "show now playing in the background" disable. I need to see if there are an option/function to force that only in certain cases, so the user doesn't need to disable it to have the mod working properly
Reply
#7
The solution deserves a new post
here it is

on the top
PHP Code:
<onload condition="Skin.HasSetting(global.showvideo)">Skin.ToggleSetting(global.showvideo

on the bottom
PHP Code:
<onunload condition="!Skin.HasSetting(global.showvideo)">Skin.ToggleSetting(global.showvideo)</onunload


Thanks for the help
Reply
#8
A better solution would be to find the code that displays the background video and make it not play when your dialog is visible.
Reply
#9
(2017-01-22, 11:16)Hitcher Wrote: A better solution would be to find the code that displays the background video and make it not play when your dialog is visible.
That's true, but this is a mod,
so the least I change on the original files, the better.

Thanks for the help
Reply
#10
All you would need to do is find basic the first image control of includes that had background in the windows.xml

Then do a search of all the .XML that have includes until you find it.... Once u find it should be a list of different things... In the list will be a video window control

In the <visible> line add | !Window.Is Active(whatever the I'd of the dialog is)


That should get rid of the video in the background
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply

Logout Mark Read Team Forum Stats Members Help
Play video when a dialog window opens0