Azure media services - Issue with viewing an encoded video on IOS - ios

I have an Azure Web App.
The end user can view video files in the application, both with and without encoding.
Without encoding, everything works fine on all client devices-
The file URL in this case looks as following:
videojs: dispatching event: sourceset
[{"src":"https://myAppName.blob.core.windows.net/myAppName/videoFileName.mp4","type":"video/mp4"}]
For encoding, we use the Azure media services.
In this case (with encoding), the file url looks as following:
videojs: dispatching event: sourceset [{"src":"https://myAppName.streaming.mediaservices.windows.net/47686721654-6056-477190467269/5f4404565467771890ab66920d936327.ism/manifest","type":"video/mp4","techOrder":["azureHtml5JS","flashSS","silverlightSS","html5"],"protectionInfo":[{"type":"AES","authenticationToken":"provided"}]},{"src":"https://myAppName.streaming.mediaservices.windows.net/47686721654-6056-477190467269/5f4404565467771890ab66920d936327.ism/manifest(format=mpd-time-csf)","type":"video/mp4","protectionInfo":[{"type":"AES","authenticationToken":"provided"}]},{"src":"https://myAppName.streaming.mediaservices.windows.net/47686721654-6056-477190467269/5f4404565467771890ab66920d936327.ism/manifest(format=m3u8-aapl-v3)","type":"video/mp4","protectionInfo":[{"type":"AES","authenticationToken":"provided"}]}]
When the end user tries to view this encoded video on iphone - IOS, it does not play successfully.
On Windows, it works well.
I read this article about url suffix needed to be added to video file url: specific suffix for each device, but I'm not sure this is the problem.
https://www.returngis.net/en/2014/11/microsoft-azure-media-services-testing-output-formats-in-live-streaming/
I will appreciate your help.

Can you try playing the videos in http://ampdemo.azureedge.net/ and see if that works. If you check Advanced, you will be able to specify specific formats.

Related

iOS cannot preview RTF from React PWA

We have a React PWA where we initially download RTF-Documents and save them to an indexDB. We use createObjectURL and an a with a.click() to simulate a download when the file is requested by the User.
The mimetype is set to application/rtf in the createObjectURL call.
However, on iOS (with Safari) the default "view" operation shows the following:
This file cannot be previewed
It might be corrupted or of an unknown file format.
The same file works from our "normal" webapp (i.e. file is served from a backend server). I tried to set the headers exactly like our backend server does, but it either doesn't show the "view" Button at all or it shows the error.
Any ideas how to set up the calls, so iOS will show the RTF correctly?

How to get file location of an song in iPod library in iOS

I have the reference of a MPMediaItem when user selects an audio from the iPod library. I am getting the asset url of that item by using
let url = item.valueForProperty(MPMediaItemPropertyAssetURL)
But this is not giving me the exact physical location of the file, instead it is giving me an url w.r.t iPod library.
ipod-library://item/item.mp3?id=1840064795502796074
Is there a way to get the physical url of a song from iPod library?
EDIT - actually I want to extract NSData from the physical file and send it to my backend server, so i need the physical file URL and not the relative URL
Due to copyright protection you can only play songs from music library. You can't access row audio file! But there are some tricks that can help like you can export music because you can do mixing type of stuff and after creating your new edited file you have new copy of your music file and you can send it I thing, but can't send directly from library like you send photo and video! You have to export it with export session first!
Refer this so post for that!
You should refer Apple sample code for that
And this so post and this tutoria also may helpful to you!

How to play a video from URL with no file extension in iOS?

I need to play a video at this url: http://ep-lin-upload.s3.amazonaws.com/vupl_lin/F64/CDF/F64CDF3B0348471E95C244DE2DDDD3F3
The mime type of the video is: video/mp4
NSURL *adURL = [NSURL URLWithString:#"http://ep-lin-upload.s3.amazonaws.com/vupl_lin/F64/CDF/F64CDF3B0348471E95C244DE2DDDD3F3"];
AVPlayer *player = [AVPlayer playerWithURL:adURL];
This code works for urls with file extension. However, AVPlayer does not recognise the mime type if there is no file extension I think. How can I get around this?
Note: I think that Tom's comment is correct and that the player would almost certainly handle the file correctly if the server included the correct MIME type in the response.
Having said that, the behaviour in browser is interesting even though your use case is iOS client based as you point out:
The following fiddle works fine on Chrome on a Mac and on IE on Windows but not on Safari:
<video width="320" height="240" controls>
<source src="http://ep-lin-upload.s3.amazonaws.com/vupl_lin/F64/CDF/F64CDF3B0348471E95C244DE2DDDD3F3" type="video/mp4">
</video>
Testing on a different server, i.e not using Amazon S3, and with different mp4 videos (e.g. BigBuckBunny) produces the same result: Chrome and IE are happy even if the extension is not there but Safari seems to require it or it will not play the video.
Update (or more accurately, updated update): looking at the request and response in both Safari and Chrome it seems that Safari is also not sending any headers in the request message. After some searching this appears to be an issue that has been seen before and S3 will reject requests without referer headers. You can update the S3 policy to allow a special referer header of 'empty' - see info below.
However, given that the same behaviour exists on a different server, it seems more likely that Chrome and IE assume that the 'type=video/mp4' info in the HTML is correct and hence interpret the content this way, while Safari looks at the content type in the response to make its decision (i.e. Chrome plays the returned file as video even though the response header says 'Content-Type:application/octet-stream' rather than 'video/mp4').
For more information on the S3 header policies mentioned above, take a look at the section "Restricting Access to a Specific HTTP Referrer" in this S3 policy page for more information on policies and the referrer header:
http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-4
In particular the following note:
Suppose you have a website with domain name (www.example.com or example.com) with links to photos and videos stored in your S3 bucket, examplebucket. By default, all the S3 resources are private, so only the AWS account that created the resources can access them. To allow read access to these objects from your website, you can add a bucket policy that allows s3:GetObject permission with a condition, using the aws:referer key, that the get request must originate from specific webpages.

Phonegap RemoteControls ios Plugin not working when device is offline

I am using RemoteControls phonegap plugin on iOS to control playing audio while device goes to sleep (https://github.com/shi11/RemoteControls) - great plugin !!
however - when the device is offline it does not work correctly … the audio title shows up as the full file path to the audio .mp3 rather than the 'title' passed to the plugin - this works fine when online.
It would seem the issue is down to the setting of the remoteImage - this is downloaded to the app to allow access offline but I use a 'Library no-cloud' location …. even if this is not set .. ie. remoteImage = "" it will not display the title - only the fullpath ( which is very confusing to the user). Even when device is online but the image path points to the local file thumbnail path then it fails to display the title (again just the local audio mp3 file path) … and no thumbnail image. But when online and the image points to a remote valid url image (even though the filepath to local audio .mp3 is the same) all works as expected.
I am no objective-c developer - but looking at the code it appears that it is expecting an image called 'no-image' when offline and can not find the thumbnail image path … but where should this be held ? and regardless of whether an image is available or not should the plugin still function so that the title is the one passed from the app (same as when online) as this is only a string …. not a file path !!
Any help really appreciated - great plugin but need it to work same way when offline ….
I think you're right. The plugin doesn't function accurately (or as you expected) when the device is offline. The only way to fix this is to fix the code and build/release. If it's not your code, or you can't fix it, then the vendor/maker has too. Contact them?

Direct file download vs reading a file back as download

Is there any difference between creating a direct link to a file on a server, and doing something like reading the file from a location and setting the content type header then streaming back the data.
I'm curious because I have a webserver that i'm using to download apps to a blackberry, if i create a file and have a direct link to that file it works, but if i stream it back using an webpage it doesn't work. The phone gets the file but it doesn't work.
Things to note:
urls are the same in both cases ie (http://somesite.com/download/file.jad)
in a browser using fiddler the downloads/header are exactly the same byte for byte
So why would the phone prefer a file that's actually a direct link vs one that is a controller streaming the data back when the data transmitted and the url are identical?
The .JAD file is just the first part of the download - there are also the .COD files associated with it (referenced in the JAD). Did you ensure that your "streaming" method is sending back the COD file correctly and with the correct MIME types?
I discovered a fix for this problem though I'm still not sure what causes it. I have been delivering the link to the phone through the sms/email gateway. When the phone gets the sms and I select the link for download it asks if i want to get the jad i hit yes and it shows up and drop out. I put the exact same link on another page as an html link and sent an sms pointing to that page. The web site throws an error... So I copied and pasted the link into the phones browser and the page shows up just fine, I click the jad download link on the page and now the jad works fine.
So i'm thinking two things either there is some sort of security mechanism that prevents direct links in sms(but this has worked for other files) Or the way the phone gets the url is different.
I ran some tests and noticed something else, on a page that accepts an id value (http://site.com/download/145) where 145 is an id for a file, if you go to that link in a phone browser it works fine and you download the file. If you send it in an sms the server errors out saying that the id is expected to be a float and it received a string. So why is it that when the phone links directly from sms the url parameters are strings but when used in a browser the actually get parsed as a float?
Sorry for the long winded explanation but it's a strange issue.

Resources