Problem with Players
Posted: Sat Mar 01, 2014 9:42 pm
Hello,
I have some issues with the Video Player. I'm trying to create a Media Player that rotates between two cards and loads an element of an array that contains the path of videos and images that will be loaded. First I have set the visible to false, loaded the new file and then set the visible to true again. This worked on MacOS but on Android the Video was freezing. According to one of your employees the Video object has to be deleted on Android before playing the next video. So I have decided to always delete the player and create a new one. Not only the Android Player but also the MacOS Player.
Now the problem is that when I delete the object it works the first time when I open the card. But if I open the card again the player shrinks to a small square. I assume this happens when an error has occurred.
Can you answer following questions?
* Should it work to delete and re-create a player on MacOS in the code? Or is it intended to create one player that will be made visible/invisible?
* Why is the player shrinking to a small square, even though I have defined it to scale to the size of the card?
* Why is it working the first time when I load the livecode file but when I close it and try another time I see the video in a small square?
It seems like randomly when I open the livecode file the video is once a small square and once it's scaling again. I have now tested with rotation and most of times when I open the file the first time the video is showing as small square but as soon the next movie plays the then everything is scaling correctly. Seems like sometimes the code is not fully executed when opening the file. Or at least the width and height are not set yet.
I have added a wait 5 seconds to the OpenStack section and with this it works. This does it as a work around but I'm not sure if this is really the final solution.
I'm using LiveCode Commercial 6.5.2.
Thanks for your help.
I have some issues with the Video Player. I'm trying to create a Media Player that rotates between two cards and loads an element of an array that contains the path of videos and images that will be loaded. First I have set the visible to false, loaded the new file and then set the visible to true again. This worked on MacOS but on Android the Video was freezing. According to one of your employees the Video object has to be deleted on Android before playing the next video. So I have decided to always delete the player and create a new one. Not only the Android Player but also the MacOS Player.
Now the problem is that when I delete the object it works the first time when I open the card. But if I open the card again the player shrinks to a small square. I assume this happens when an error has occurred.
Can you answer following questions?
* Should it work to delete and re-create a player on MacOS in the code? Or is it intended to create one player that will be made visible/invisible?
* Why is the player shrinking to a small square, even though I have defined it to scale to the size of the card?
* Why is it working the first time when I load the livecode file but when I close it and try another time I see the video in a small square?
It seems like randomly when I open the livecode file the video is once a small square and once it's scaling again. I have now tested with rotation and most of times when I open the file the first time the video is showing as small square but as soon the next movie plays the then everything is scaling correctly. Seems like sometimes the code is not fully executed when opening the file. Or at least the width and height are not set yet.
I have added a wait 5 seconds to the OpenStack section and with this it works. This does it as a work around but I'm not sure if this is really the final solution.
I'm using LiveCode Commercial 6.5.2.
Thanks for your help.
Code: Select all
on OpenStack
end OpenStack
on OpenCard
startVideo
wait 5 seconds
stopVideo
end OpenCard
on resizeStack
resizeVideo
end resizeStack
on startVideo
if the environment is "mobile" then
else
if exists(player "Video") then
delete player "Video"
end if
create player "Video"
set the width of player "Video" to the width of this card
set the height of player "Video" to the height of this card
set the top of player "Video" to 0
set the left of player "Video" to 0
set the lockLoc of player "Video" to true
set the showBorder of player "Video" to false
set the filename of player "Video" to "/Users/charms/Documents/LiveCode/testdata/videos/1.mp4"
start player "Video"
end if
end startVideo
on stopVideo
if the environment is "mobile" then
else
if exists(player "Video") then
delete player "Video"
end if
end if
end stopVideo
on resizeVideo
if the environment is "mobile" then
else
if exists(player "Video") then
set the width of player "Video" to the width of this card
set the height of player "Video" to the height of this card
end if
end if
end resizeVideo