Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Upload video not work

Discussion in 'Unity Everyplay' started by MadByteLabs, Jun 16, 2015.

  1. MadByteLabs

    MadByteLabs

    Joined:
    May 29, 2011
    Posts:
    18
    Hi, i integrate everyplay service in my game. Add settings. Im call start record, stop record and play last recording video, this logic work. Only not work upload video, not called UploadDidStart, UploadDidProgress events and in dashboard see 0 replays. Sorry for my english. Thanks.
     
  2. surathunity3d

    surathunity3d

    Moderator

    Joined:
    Sep 30, 2014
    Posts:
    128
    Hi @Lestar,

    Did the video get recorded?
    Did you click on the upload button on the Share Modal?

    Cheers
    Surath
     
  3. MadByteLabs

    MadByteLabs

    Joined:
    May 29, 2011
    Posts:
    18
    Yes, video recorded, i can play video after call StopRecording as call PlayLastRecording.
    No, i think upload start automatically to everyplay. Thanks.
     
  4. surathunity3d

    surathunity3d

    Moderator

    Joined:
    Sep 30, 2014
    Posts:
    128
    Hi @Lestar could you post a video for the sharing flow that you see. It will be easier for us to understand the issue better.

    Cheers
    Surath
     
  5. MadByteLabs

    MadByteLabs

    Joined:
    May 29, 2011
    Posts:
    18
    Hi surathunity3d.
    In our game we want record video and upload to everyplay server automatically without any player actions. Other players can watch uploaded videos using meta-data.
    Below you can find piece of code and see how it works. After "PlayLastRecording" called we can watch last recorded video, edit, upload and share it using provided UI. We expect that video will start upload automatically but we don't receive "UploadDidStart" event.
    Code (CSharp):
    1.  
    2. public enum EveryPlayState
    3. {
    4.     None,
    5.     Init,
    6.     NotSupport
    7. }
    8.  
    9. public class EveryPlayController : MonoBehaviour
    10. {
    11.     private EveryPlayState state;
    12.  
    13.     public delegate void EveryDelegate (EveryPlayState _state);
    14.     public event EveryDelegate Ready;
    15.     public event EventHandler StartRecording;
    16.     public event EventHandler StopRecording;
    17.  
    18.     private void Awake ()
    19.     {
    20.         Everyplay.Initialize ();
    21.     }
    22.     private void Start ()
    23.     {
    24.         Init ();
    25.     }
    26.  
    27.     public void Init ()
    28.     {
    29.         state = EveryPlayState.None;
    30.         Everyplay.ReadyForRecording += OnReadyForRecording;
    31.         Everyplay.RecordingStarted += SendStartRecording;
    32.         Everyplay.RecordingStopped += SendStopRecording;
    33.         Everyplay.UploadDidStart += StartUploadHandler;
    34.         Everyplay.UploadDidComplete += CompleteUploadHandler;  
    35.     }
    36.  
    37.     private void OnDestroy ()
    38.     {
    39.         Everyplay.ReadyForRecording -= OnReadyForRecording;
    40.         Everyplay.RecordingStarted -= SendStartRecording;
    41.         Everyplay.RecordingStopped -= SendStopRecording;
    42.         Everyplay.UploadDidStart -= StartUploadHandler;
    43.         Everyplay.UploadDidComplete -= CompleteUploadHandler;
    44.     }
    45.  
    46.     private void SendReady (EveryPlayState _state)
    47.     {
    48.         if (Ready != null)
    49.             Ready (_state);
    50.     }
    51.     // Send
    52.     private void SendStartRecording ()
    53.     {
    54.         Debug.Log ("----------------Start recording event-----------");
    55.         Debug.Log ("Is support: " + Everyplay.IsSupported ());
    56.         Debug.Log ("Is support recording: " + Everyplay.IsRecordingSupported ());
    57.         if (StartRecording != null)
    58.             StartRecording (this, new EventArgs ());
    59.     }
    60.     // Send
    61.     private void SendStopRecording ()
    62.     {
    63.         Debug.Log ("----------------Stop recording event-----------");
    64.         Everyplay.PlayLastRecording ();
    65.         if (StopRecording != null)
    66.             StopRecording (this, new EventArgs ());
    67.     }
    68.     private void OnReadyForRecording (bool ready)
    69.     {
    70.         if (ready) {
    71.             if (Everyplay.IsSupported ())          
    72.                 state = EveryPlayState.Init;
    73.             else
    74.                 state = EveryPlayState.NotSupport;
    75.         }
    76.         SendReady (state);
    77.         Debug.Log ("Init Everyplay state: " + state);
    78.     }
    79.     // Not Send
    80.     private void StartUploadHandler (int videoId)
    81.     {
    82.         Debug.Log ("Start upload video: " + videoId);
    83.     }
    84.  
    85.     private void CompleteUploadHandler (int videoId)
    86.     {
    87.         Debug.Log ("Complete upload video: " + videoId);
    88.     }
    89.  
    90.     #region recording
    91.     public void StartRecordVideo ()
    92.     {
    93.         if (state == EveryPlayState.Init) {
    94.             Everyplay.StartRecording ();
    95.             Debug.Log ("Start recording video");
    96.         }
    97.     }
    98.     public void StopRecordingVideo ()
    99.     {
    100.         if (state == EveryPlayState.Init) {
    101.             if (Everyplay.IsRecording ()) {
    102.                 Everyplay.StopRecording ();
    103.                 Debug.Log ("Stop recording video");
    104.             }
    105.         }
    106.     }
    107.     public void PauseRecording ()
    108.     {
    109.         if (state == EveryPlayState.Init)
    110.             Everyplay.PauseRecording ();
    111.     }
    112.     public void ResumeRecording ()
    113.     {
    114.         if (state == EveryPlayState.Init)
    115.             Everyplay.ResumeRecording ();
    116.     }
    117.     #endregion
    118.     #region playing
    119.  
    120.     public void PlayLastRecording ()
    121.     {
    122.         if (state == EveryPlayState.Init) {
    123.             Everyplay.PlayLastRecording ();
    124.             Debug.Log ("Play Last Recording");
    125.         }
    126.     }
    127.     #endregion
    128.  
     
  6. surathunity3d

    surathunity3d

    Moderator

    Joined:
    Sep 30, 2014
    Posts:
    128
    Hi @Lestar

    Unfortunately, what you are expecting is not in alignment with our design. At the moment, user needs to opt in to share something to Everyplay by going through the share modal which you can trigger using ShowSharingModal() method.
    Videos don't get uploaded automatically and there is no way to change this at the moment.

    Hope this helps!

    Cheers
    Surath
     
  7. MadByteLabs

    MadByteLabs

    Joined:
    May 29, 2011
    Posts:
    18
    Hi. In the code snippet below you can see how we add meta-data to the video and how we get video using meta-data. Meta-data is always unique for every video. When we request meta-data we always get full list of videos for current client_id

    Code (CSharp):
    1.  
    2. // Add metadata
    3. Everyplay.SetMetadata ("attack",attack_Id);
    4.  
    5. //Get video
    6. string searchUrl = "/games/current/videos?client_id=" + Everyplay.GetId () + "&meta_data=" + attack_Id.ToString ();
    7. Everyplay.MakeRequest("get", searchUrl, null, delegate(string data) {
    8.             List<System.Object> videos = EveryplayMiniJSON.Json.Deserialize(data) as List<System.Object>;
    9.             Debug.Log("Videos count: "+videos.Count );      
    10.         }, delegate(string error) {
    11.                Debug.Log("Error: "+error)
    12.         });
    13.  
    response.png
     
  8. MadByteLabs

    MadByteLabs

    Joined:
    May 29, 2011
    Posts:
    18
    No solution to obtain a single value for the unique metadata?
     
  9. Neodrop

    Neodrop

    Joined:
    Oct 24, 2008
    Posts:
    1,359