Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by marko.tanic · Jun 16, 2014 at 11:10 AM · iosvideocloudstreamingu3dxt

HTTP Live Streaming from Kii Cloud Storage?

Hi,

I'm developing an app that would use video streaming. Application would be streaming videos form Kii cloud storage. How should that be done with U3DXT?

I've tried uploading video segments as KiiObject bodies and publishing them. Next, I put their URL's in m3u8 file. After that, I uploaded m3u8 file also as KiiObject body and published it. Then, I took its URL and copied it into your Video Streaming example script (from the sneak a peak u3dxt). It couldn't play the video.

Please note that it did work when I tried uploading video segments and m3u8 to apache server on my laptop.

When I tried pasting the link to the m3u8 (the one on the Kii cloud) into Safari on my Mac, it just downloaded m3u8 file, with random name given by KiiCloud and without extension, instead of playing the video. However, when I tried adding m3u8 extension to the downloaded file and when I opened it with Safari, it streamed video perfectly, so I suppose that this issue has something to do with file extensions.

Please help me resolve this issue.

This is my code (your script from the example with altered URL for 480p stream):

 using UnityEngine;
 using System.Collections;
 using System.IO;
 using U3DXT.Core;
 using U3DXT.iOS.MediaPlayer;
 using U3DXT.iOS.Native.MediaPlayer;
 using U3DXT.iOS.Native.Foundation;
 using U3DXT.Utils;
 
 public class StreamingMoviePlayer : MonoBehaviour {
 
     // Use this for initialization
     void Start () {
         if (CoreXT.IsDevice) {
             MediaExporter.ExportCompleted += OnExportCompleted;
             MediaExporter.ExportFailed += OnExportFailed;
         }
     }
     
     void OnDestroy() {
         if (CoreXT.IsDevice) {
             MediaExporter.ExportCompleted -= OnExportCompleted;
             MediaExporter.ExportFailed -= OnExportFailed;
         }
     }
     
     void OnExportCompleted(object sender, MediaExportedEventArgs e) {
         FileInfo fileInfo = new FileInfo(e.outputURL);
         Log("Exported to: " + e.outputURL);
         Log("File size: " + fileInfo.Length);
     }
     
     void OnExportFailed(object sender, U3DXTErrorEventArgs e) {
         Log("Export error: (" + e.domain + ": " + e.code + ") " + e.description);    
     }
     
     void OnGUI() 
     {
         KitchenSink.OnGUIBack();
         
         if (CoreXT.IsDevice) {
             GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height/2 - 50));
                 GUILayout.BeginVertical();
                     if (GUILayout.Button("Stream 480p", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) {    
                 MediaPlayerXT.PlayStreamingFullscreenMovie("https://api.kii.com/api/x/nk035ox7lcbdyj61shxhh7ok6");
                     }
                     if (GUILayout.Button("Stream 720p", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) {
                         MediaPlayerXT.PlayStreamingFullscreenMovie("http://trailers.apple.com/movies/focus_features/9/9-clip_720p.mov");
                     }
                     if (GUILayout.Button("Stream 1080p", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) {    
                         MediaPlayerXT.PlayStreamingFullscreenMovie("http://trailers.apple.com/movies/focus_features/9/9-clip_1080p.mov");
                     }
             
                     if (GUILayout.Button("Export First Song in Music Library to Storage", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) {    
                         ExportFirstSong();
                     }
     
                 GUILayout.EndVertical();
             GUILayout.EndArea();
         }
         
         OnGUILog();
     }
     
     void ExportFirstSong() {
         MPMediaQuery query = MPMediaQuery.SongsQuery();
         
         if (query.items.Length == 0) {
             Log("No songs in Music Library.");
             return;
         }
         
         // get first song
         MPMediaItem mediaItem = query.items[0] as MPMediaItem;
         
         Log("Exporting song: " + mediaItem.Value(MPMediaItem.PropertyTitle));
 
         // use null for outputFolder and outputFile to name it [artist] - [title]
         if (!MediaExporter.ExportAudio(mediaItem, null, null, true))
             Log("Export error or song has DRM.");
     }
     
 #region Debug logging
     string _log = "Debug log:";
     Vector2 _scrollPosition = Vector2.zero;
     
     void OnGUILog() {
         GUILayout.BeginArea(new Rect(50, Screen.height / 2, Screen.width - 100, Screen.height / 2 - 50));
         _scrollPosition = GUILayout.BeginScrollView(_scrollPosition);
         GUI.skin.box.wordWrap = true;
         GUI.skin.box.alignment = TextAnchor.UpperLeft;
         GUILayout.Box(_log, GUILayout.ExpandHeight(true));
         GUILayout.EndScrollView();
         GUILayout.EndArea();
     }
     
     void Log(string str) {
         _log += "\n" + str;
         _scrollPosition.y = Mathf.Infinity;
     }
 #endregion
 }
 
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by u3dxt · Jun 16, 2014 at 09:46 PM

Hi Marko, you are correct. iOS as well as Safari have problems playing the file if there is no extension. Others are reporting the same issue doing it natively.

However, it may be possible downloading the file first and save it with an extension and play it locally. We have tried this without success though. We don't know much about streaming and maybe you can try and see if you can get it to work. One other thing to consider is inside the file, there are links to kii without file extensions. This could also be an issue.

 string path = Application.temporaryCachePath + "/file.m3u8";
 Debug.Log("path: " + path);
 
 NSData data = new NSData(new NSURL("https://api.kii.com/api/x/nk035ox7lcbdyj61shxhh7ok6"));
 data.WriteToFile(path, true);
 
 MediaPlayerXT.PlayStreamingFullscreenMovie(path);
 
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Pixel Stream - Camera streaming 1 Answer

Videos don't play in Apple Appstore build 0 Answers

Unity simple client server video streaming using RPC calls to send webcamTexture 2 Answers

Record a video in unity on mobile (Android, IOS) 1 Answer

U3DXT in-app purchase Init failed and everything is setup! 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges