The play button on the iOS video player will be deactivated automatically after watching 15 videos

I have developed an application using the Ionic Framework that includes multiple videos for playback. To organize these videos, I created a category system where users can click on a video title to access the corresponding video player page. The video player page contains a simple HTML structure with a video tag:

<video controls style="background:#000;width:100%;" playsinline></video>

Within the video player controller, I implemented logic to display the correct video in the tag:

function ($scope, $rootScope, $stateParams, $filter) {
            $scope.video = $filter('getById')($rootScope.videos, $stateParams.videoId);
            $scope.videoUrl = 'video/' + $rootScope.category + '/' + $stateParams.videoId + '#t=0';

            $scope.playVideo = function(){
              var vidURL = $scope.videoUrl;
              var myVideo = document.getElementsByTagName('video')[0];
              myVideo.src = vidURL;
              myVideo.load();
              myVideo.play();
            }
            $scope.playVideo();
       }

Everything works smoothly for the first 15 videos played, but after that, the play icon becomes disabled and no further videos can be played without restarting the app.

https://i.sstatic.net/5H2J6.jpg

This issue only occurs on devices, as it functions correctly in browsers and iOS simulators.

No errors are reported in the Xcode log.

It appears there is a limitation of loading only 15 videos in the same view within the app.

I attempted to use an iframe instead of the video tag:

<div class="player" style="background: #000; ">
          <iframe src="{{videoUrl}}" width="100%" style="background: #000; position: absolute; height: 100vh" autoplay="0" playsinline></iframe>
        </div>

While this resolved the error, I encountered difficulties playing the video inline due to the inability to include the playsinline tag within the iframe content.

Any suggestions or insights would be greatly appreciated.

Answer №1

One limitation of iOS is that it does not allow more than 15 video tags on a single page. If you encounter this issue, the solution involves clearing the video references. You can use the code snippet below to achieve this:

$('video').each(function(){
    var vid = $(this)[0];
    vid.pause();
    vid.src="";
    vid.load();
    $(this).remove();
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for showing an alert when incorrect login credentials are entered on a login form

<?php include('includes/config.php'); if(isset($_POST["submit"])){ $empid=$_POST["empid"]; $pass=$_POST["password"]; $query=mysqli_query($conn,"SELECT employee_id, fname,lname,empid,password, status, role FROM employee where empid='$emp ...

Why is this specific element showing as undefined in the form during editing, but appearing correctly in both the debugger and console.log?

I've encountered an error that keeps popping up: "Cannot read property 'textContent' of undefined at HTMLDocument". This error specifically occurs when dogName, dogBreed, and dogSex are set within the 'click' listener. It's st ...

Facing issues with React JS and Material UI? If you're encountering problems where 'this.props' is

After running the code provided below, I anticipated that the styles would be injected within props. However, I consistently encounter undefined props. No props are being supplied to this component. const customStyles = theme => ({ root: { & ...

Incorporating the "+ " icon in Vuejs Dropzone to indicate the presence of existing images

Looking to enhance my Vue-dropzone file uploader component by adding an icon or button labeled "Add more images" when there are already images present in the dropzone. This will help users understand that they can upload multiple photos. Any suggestions on ...

Challenge with setting asynchronous default value in React Material UI Autocomplete

Utilizing the 'Material UI' Autocomplete component to show a dropdown in my form. Whenever the user wishes to edit an item, the dropdown should autofill with the corresponding value fetched from the database. Attempting to simulate this scenario ...

Effortlessly move and rearrange various rows within an HTML table by utilizing JQuery alongside the <thead> elements

My JsFiddle has two tables and I want to switch rows <tr> between them using Jquery. However, due to the presence of the <thead> tag, it is not functioning properly. I suspect that the issue lies with the items in the selector, but I am unsure ...

iOS: Establish a secure link to a web server to enable exclusive communication with the app

Looking to create a secure web service connection from an iOS app to a web server, I understand that HTTPS is crucial for encrypting the transferred data. However, I'm now hoping to implement authentication measures that restrict access to the web in ...

The implementation of Ajax beforeSend and complete functions is not possible at the moment

I’ve been attempting to implement a spinner image while loading ajax data, but I can't seem to get it to work. Here's my code : $.ajax({ url: '/Observer/GetInfoProfileByProfileId', type: 'POST', data: { ProfileId: ...

What are some strategies for optimizing speed and efficiency when utilizing jQuery hover?

While developing a web application, I have created a grid using multiple div elements that are X by Y in size, determined by user input. My goal is to change the background color of surrounding divs within a certain distance when hovering over one particul ...

Having trouble with jQuery after adding more content?

I recently started delving into the world of javascript, incorporating it into my website. Just last week, I came across a script that utilizes jQuery to load extra content onto my page. Initially, everything seemed to be functioning smoothly until I reali ...

My attempts to utilize the local storage key have been unsuccessful in storing my todo list. I am uncertain where the issue lies within my code

I've been working on a Todo List with local storage in React, but I'm running into an issue. It seems that my todos aren't getting stored properly and are disappearing every time the page refreshes. I need to figure out what's causing t ...

Create a pair of divs on your webpage that users can drag around using HTML5

Hello to all HTML5 developers! I am currently facing an issue where I am attempting to designate two separate divs as dragable areas for incoming files. Unfortunately, it seems that only one of them can be active at a time. How can I adjust my code so th ...

What is the purpose of a form that includes a text input field and a button that triggers a JavaScript function when the enter key is pressed?

<form action=""> <input id="user_input" onKeyDown="if(event.keyCode == 13)document.getElementById('okButton').click()" > <input id="okButton" type="button" onclick="JS_function();" value="OK"> </form> I'm trying to a ...

The xslt code is failing to invoke the JavaScript function

I am currently utilizing xslt for the transformation of xml to html. Below is an example of an .xml file. <ImportOrganizationUtility-logging> <log-session module-name="ImportOrganizationUtility" end="17:54:06" start="17 ...

The function '$.fn.<new_function>' is not a valid function in jQuery

UPDATE: code link with enhanced formatting: UPDATE: code upgraded with enhancements from JSHint http://pastebin.com/hkDQfZy1 I am attempting to utilize $.fn to establish a new function on jQuery objects by this method: $.fn.animateAuto = function(x,y) { ...

Bring div button on top of the contenteditable field

I am working on an Angular app for a client and need to implement a clickable button at the bottom right of a contenteditable element, similar to the image shown below : https://i.sstatic.net/J6XdW.png The challenge is that the content needs to be scroll ...

Leverage Dropzone functionality in combination with node.js

Just starting out with node.js and experimenting with file uploads using drag and drop. Initially, I created a basic uploader without drag and drop functionality: var http = require('http'); var formidable = require('formidable'); ...

Select2 eliminates every tag except the first one

I am currently utilizing Select2 in Django for handling many-to-many relationships. The best approach I have found to handle all validation constraints is to create related objects through an AJAX request as soon as they are entered into the Select2 tag fi ...

Determine whether a directive possesses a specific attribute

Here is my current code snippet: <my-directive></my-directive> I am trying to include a ternary operation within it like this: {{ $scope.my-option ? 'YES' : 'NO' }} Is it possible to achieve the desired result by adding ...

Is it possible to utilize AJAX to load the URL and then extract and analyze the data rather than

I had originally created a web scraping method using PHP, but then discovered that the platform I was developing on (iOS via phone gap) did not support PHP. Fortunately, I was able to find a solution using JS. $(document).ready(function(){ var container ...