Commit 1f466fee authored by DANDOCON's avatar DANDOCON

Actualización de reproducción de videos

parent a2c03383
......@@ -170,8 +170,7 @@ public class GestorMenuInteractivo : MonoBehaviour
arryListVideos.Add("FECHA_INI_NA, HORA_INI_NA, FECHA_FIN_NA, HORA_FIN_NA, https://www.youtube.com/watch?v=_PrNnXyR-Ho");
arryListVideos.Add("FECHA_INI_NA, HORA_INI_NA, FECHA_FIN_NA, HORA_FIN_NA, https://www.youtube.com/watch?v=p3qtKmNoyb4");
}
string auxUrl= ((string) arryListVideos[0]).Split(',')[4];
rawImageVideo.transform.GetChild(0).GetComponent<YoutubePlayer.VideoControl>().Prepare(auxUrl);//Se le pasa el url del video que se desea reproducir
ManagerReproductionVideos(0, "PROMO", "");
//Lleno el panel que contiene la lista de observatorios
foreach (JSONNode item in dataApi["observatorios"].AsArray)
{
......@@ -247,7 +246,23 @@ public class GestorMenuInteractivo : MonoBehaviour
return posicionBotonSeleccionado;
}
//Gestionar los videos que se debe de reproducir
public void ManagerReproductionVideos(int posArray = 0, string typeReproductor = "", string url = ""){
//Verificar que tipo de reproducción de video es la que se decea realizar
if(typeReproductor == "PROMO"){
//Validar si la posición del array es una posición que existe
if(posArray >= arryListVideos.Count){
posArray = 0;
}
string auxUrl= ((string) arryListVideos[posArray]).Split(',')[4];//Obtener la url del video
rawImageVideo.transform.GetChild(0).GetComponent<YoutubePlayer.VideoControl>().Prepare(auxUrl, typeReproductor, posArray);//Se envian los datos de reproducción del video
}else{
rawImageVideoOfertas.SetActive(true);//Activamos el GameObject que visualiza el video
rawImageVideoOfertas.transform.GetChild(0).GetComponent<YoutubePlayer.VideoControl>().Prepare(url, typeReproductor, posArray);//Se envian los datos de reproducción del video
}
}
//Cargar videos de oferta segun el area clickeada
void visualizarVideosTitulaciones(int posicionBoton){
......@@ -265,8 +280,7 @@ public class GestorMenuInteractivo : MonoBehaviour
void ReproducirVideoTitulacion(string nombre, string url){
contarTime=false;
TextTituloVideoOferta.GetComponent<Text>().text = nombre;
rawImageVideoOfertas.SetActive(true);
rawImageVideoOfertas.transform.GetChild(0).GetComponent<YoutubePlayer.VideoControl>().Prepare(url);
ManagerReproductionVideos(0, "TITULACION", url);
estadoBotonVolverVideoTitulacion(false);
NavegacionMenus(4);
}
......@@ -784,8 +798,7 @@ public class GestorMenuInteractivo : MonoBehaviour
arryListVideos.Add("FECHA_INI_NA, HORA_INI_NA, FECHA_FIN_NA, HORA_FIN_NA, https://www.youtube.com/watch?v=ZbI4lHBSrqo");
}
rawImageVideo.SetActive(true);
string auxUrl= ((string) arryListVideos[0]).Split(',')[4];
rawImageVideo.transform.GetChild(0).GetComponent<YoutubePlayer.VideoControl>().Prepare(auxUrl);
ManagerReproductionVideos(0, "PROMO", "");
}
}
......
......@@ -10,6 +10,11 @@ namespace YoutubePlayer
public GameObject EfectLoad;
YoutubePlayer youtubePlayer;
VideoPlayer videoPlayer;
string url = "";
string typeRep = "";
int pos = 0;
bool reproducirVideo=false;
private void Awake(){
BackgroundVideo.SetActive(true);
......@@ -19,16 +24,33 @@ namespace YoutubePlayer
videoPlayer.prepareCompleted += VideoPlayerPreparedCompleted;
}
private void Update (){
if(reproducirVideo){
if(((float)videoPlayer.frame / (float)videoPlayer.frameCount) >=0.99 ){
reproducirVideo = false;
if(typeRep == "PROMO"){
pos=pos+1;
GestorMenuInteractivo.instancia.ManagerReproductionVideos(pos, typeRep, url);
}else{
GestorMenuInteractivo.instancia.TerminoVideoOferta();
}
}
}
}
void VideoPlayerPreparedCompleted(VideoPlayer source){
BackgroundVideo.SetActive(!source.isPrepared);
EfectLoad.SetActive(!source.isPrepared);
}
public async void Prepare(string url_video){
public async void Prepare(string url_video = "", string typeReproductor = "", int posArray = 0){
print("Cargando video");
try
{
youtubePlayer.youtubeUrl = url_video;
url = url_video;
typeRep = typeReproductor;
pos = posArray;
await youtubePlayer.PrepareVideoAsync();
print("Video cargado");
PlayVideo();
......@@ -41,6 +63,7 @@ namespace YoutubePlayer
public void PlayVideo(){
videoPlayer.Play();
reproducirVideo = true;
}
public void PauseVideo(){
......
......@@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 256
m_Height: 256
m_Width: 1000
m_Height: 580
m_AntiAliasing: 1
m_MipCount: -1
m_DepthStencilFormat: 92
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"process_id" : 50210,
"process_id" : 10071,
"version" : "2022.1.22f1",
"app_path" : "/home/rolando/Unity/Hub/Editor/2022.1.22f1/Editor/Unity",
"app_contents_path" : "/home/rolando/Unity/Hub/Editor/2022.1.22f1/Editor/Data"
......
{"m_ScrollY":0.0,"m_ExpandedSceneGameObjectInstanceIDs":[-1600,-1238,25908,26010,26100,26126,26188],"m_LastClickedInstanceID":-5394,"m_OpenSceneGUIDs":["802c306a2e0fa8d4f87d3cdfbaedc189"]}
\ No newline at end of file
{"m_ScrollY":0.0,"m_ExpandedSceneGameObjectInstanceIDs":[-1972,-1780,-1592,-1238],"m_LastClickedInstanceID":0,"m_OpenSceneGUIDs":["ec656ab001bf54a4582c1cfbef941984"]}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -12,10 +12,10 @@ EditorUserSettings:
value: 00530c5706030b5d540a5c701175084146161e79797c77687f784c30b2e5656d
flags: 0
RecentlyUsedSceneGuid-2:
value: 0652025353540b0b5d5f0e2445775e44434f4a297d2b2032282f4467b3b96c6c
value: 5b01060556055f5a5f0b5c24117b5b44104f4f2e7f2b22362f281837e1b16c61
flags: 0
RecentlyUsedSceneGuid-3:
value: 5b01060556055f5a5f0b5c24117b5b44104f4f2e7f2b22362f281837e1b16c61
value: 0652025353540b0b5d5f0e2445775e44434f4a297d2b2032282f4467b3b96c6c
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
......
......@@ -48,7 +48,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 53
controlID: 38
--- !u!114 &3
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -223,7 +223,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 16192, y: 16192}
vertical: 1
controlID: 54
controlID: 39
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -248,7 +248,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096}
vertical: 0
controlID: 22
controlID: 76
--- !u!114 &11
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -298,7 +298,7 @@ MonoBehaviour:
serializedVersion: 2
x: 72
y: 676
width: 1410
width: 1436
height: 363
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
......@@ -329,10 +329,10 @@ MonoBehaviour:
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 60}
m_SelectedIDs: 0a680000
m_LastClickedID: 26634
m_ExpandedIDs: 00000000e2660000e4660000e6660000726800007468000000ca9a3b
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 3a640000
m_LastClickedID: 25658
m_ExpandedIDs: 00000000126300001463000016630000186300001a63000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......@@ -360,7 +360,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000e2660000e4660000e6660000
m_ExpandedIDs: 00000000126300001463000016630000186300001a630000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......@@ -385,8 +385,8 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_ListAreaState:
m_SelectedInstanceIDs: 08700000
m_LastClickedInstanceID: 28680
m_SelectedInstanceIDs: 32640000
m_LastClickedInstanceID: 25650
m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs: c623000000000000
m_RenameOverlay:
......@@ -488,9 +488,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_SelectedIDs: 32640000
m_LastClickedID: 0
m_ExpandedIDs: eabfffff32c0ffff4cc3ffff96c3ffff16d2ffff58d3ffffb2d8ffff3ed9ffff2afbffff826200000e6300007a630000e063000002640000406400005a64000048710000b47100001a7200003c7200007a720000
m_ExpandedIDs: bee4ffff26e7ffff4ae8ffffc0f9ffff2afbffff346500009a650000f46500000e6600004c660000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment