Recently, when we are trying to distribute video from Azure Media Service, we noticed that our video can't be played in iOS mobile devices. But the same web page plays normally in Android devices.
There are multiple reasons for iOS devices to load and play Azure Media Player. As for the player itself is not open source, it might happen some strange effects when I change these settings. But the checklist does help diagnostic the issues for it.
Check the attributes on players
First, ensure your plyer has the following properties:
- autoplay
- playsinline
- controls
Like this:
<video id="player" class="azuremediaplayer amp-default-skin" controls autoplay playsinline></video>
Prevent load with nativeControlsForTouch
and some features
Using this may cause the player can't load advertisement and subtitles, but use native HTML5 video player instead of Azure Media Player custom skin.
Somehow iOS does not support those advanced features.
var myPlayer = amp('player', {
"nativeControlsForTouch": false, // <- Set to false
"logo": {
"enabled": false
},
"techOrder": [
"azureHtml5JS",
"flashSS",
"silverlightSS",
"html5"
]
});
Prevent loading the player with advertisement and subtitles:
$.get('/vast/getallads/@Model.Unit.Id',function(ads) {
var presentation = {
mainProgram: {
source: {
src: "https://video.domain/url",
type: "application/vnd.ms-sstr+xml"
},
tracks: subtitles
},
midRoll: ads.result.midRoll, // < - Do not load ads.
preRoll: ads.result.preRoll
};
myPlayer.presentationLayout(presentation); // < - Do NOT load player like this.
});
}
Just load the player like this in iOS devices:
@if(isWechat)
{
<script>
myPlayer.src([{
src: "https://video.domain/url",
type: "@Html.Raw(url.EndsWith("mp4") ? "video/mp4": "application/vnd.ms-sstr+xml")"
}]);
</script>
}
Use correct MIME types
As for Azure Media Service resources, consider using type: application/vnd.ms-sstr+xml
instead of application/dash+xml
.
As for other files, like video.mp4
, consider using type: video/mp4
.
The wrong MIME type may cause the player loads to fail.
Do not add event listeners
Adding event listeners to the player in other platforms works fine, but on iOS it may cause the player stop working or loads extremely slow.
As we tested the following code:
// Do NOT add this!
myPlayer.addEventListener('error', function playerError() {
var errorDetails = myPlayer.error();
var code = errorDetails.code;
var message = errorDetails.message;
playRefreshButton();
});
Deleting those codes greatly speeds up the player loads performance on iOS devices.
********s information. Long-Term Effects. <a href="https://viagra4u.top">where can i *** ***** viagra no prescription</a> in USA. Actual trends of pills. Get information now. <a href=https://amp.en.vaskar.co.in/translate/1?to=ru&from=en&source=Medicine%20information%20sheet.%20Effects%20of%20Drug%20Abuse.%20%3Ca%20href%3D%22https%3A%2F%2Fviagra4u.top%22%3Ewhere%20to%20get%20cheap%20viagra%20without%20prescription%3C%2Fa%3E%20in%20the%20USA.%20Some%20what%20you%20want%20to%20know%20about%20medicine.%20Get%20information%20now.%20%0D%0A%5Burl%3Dhttps%3A%2F%2Factivity.rmu.ac.th%2Fhome%2FViewActivity%2F214%5DAll%20information%20about%20drug.%5B%2Furl%5D%20%5Burl%3Dhttps%3A%2F%2Falmohaimeed.net%2Fm%2Far%2F190%5DBest%20information%20about%20meds.%5B%2Furl%5D%20%5Burl%3Dhttps%3A%2F%2Falmohaimeed.net%2Fm%2Far%2F210%5DActual%20news%20about%20drugs.%5B%2Furl%5D%20%20dfeeeb7%20&result=%D0%98%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9%20%D0%BB%D0%B8%D1%81%D1%82%D0%BE%D0%BA%20%D0%BF%D0%