58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using Assets.Scenes.Ride.Scripts;
|
|
using Assets.Scenes.Ride.Scripts.Model;
|
|
using Assets.Scripts;
|
|
using Assets.Scripts.Apis.Models;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Video;
|
|
|
|
public class testDownLoad : MonoBehaviour
|
|
{
|
|
UnityWebRequest request = null;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
//测试UI
|
|
var button = transform.GetComponent<Button>();
|
|
var text = transform.GetComponentInChildren<Text>();
|
|
var inputFiled = transform.parent.GetComponentInChildren<InputField>();
|
|
var player = FindObjectOfType<VideoPlayer>();
|
|
var testPlayer = FindObjectOfType<TestPlayerController>();
|
|
var url = @"http://192.168.0.97:6031/12067924_720p.mp4";
|
|
var currentPath = "";
|
|
inputFiled.onValueChanged.AddListener((s) =>
|
|
{
|
|
testPlayer.power = Convert.ToDouble(s);
|
|
});
|
|
button.onClick.AddListener(() =>
|
|
{
|
|
StartCoroutine(Utils.DownloadVideo("sdsd.mp4", url
|
|
,(p,req)=> {
|
|
text.text = Math.Round(p * 100, 2).ToString() + "%";
|
|
request = req;
|
|
}
|
|
,(path)=> {
|
|
text.text = "100%";
|
|
currentPath = path;
|
|
//player.url = path;
|
|
}
|
|
));
|
|
if (!string.IsNullOrEmpty(currentPath))
|
|
{
|
|
//player.url = currentPath;
|
|
}
|
|
});
|
|
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|