Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7830283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:10:03+00:00 2026-06-02T11:10:03+00:00

So this is my PHP video code it works in browsers but when I

  • 0

So this is my PHP video code
it works in browsers but when I try to get it to play on iPhones and iPads it seems to bring up the play button with x through it.

<?php
header('Content-type: video/mp4');
$homepage = file_get_contents('http://cdn.videos.budtraffic.com/sodaradio/J/Jessie%20J%20-%20Laserlight.mp4');
echo $homepage;
exit;
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:10:04+00:00Added an answer on June 2, 2026 at 11:10 am

    Explanation on Apple Web site

    Short answer :

    Because iOS device require the server to support byte-ranges request for videos, and your code does not provide that capability.

    Long answer :

    When iOS device make a request for a video, they don’t download the whole video. They download only small chunk at a time, to minimize bandwidth usage, and also because the user may want to skip to a later portion of the video without downloading the previous parts. For that purpose, they make byte ranges request. Basically, they tell the server “Hey, give me the portion of the file between the 100th and 200th byte”. Byte-range request use the Range header, and look like the following

    GET /myvideo.mp4 HTTP/1.1
    Host: www.example.com
    Range: bytes=500-999
    

    The server must in that case reply with something like that

    HTTP/1.1 206 Partial Content
    Content-Type: video/mp4
    Content-Range: bytes 500-999/20000
    

    So you will need much more than those four php line to support iOS devices. First you will to parse the Range header. This information is available in the $_SERVER['HTTP_RANGE'] global var. You will then need to fetch only that portion of the file and send it to the client. You will also need to populate the Content-Range header.

    Note that the Content-Range header include the complete file size, so your code will need to provide that information. Note also that almost every server support that kind of request for static files. If you don’t need to do special treatement to the file, a possible option is to copy the file on the public server and let it do the job for you.

    Non related comment

    Take that as constructive criticism, but your code in its current form will bring your server to its knee. You basically put the whole file in memory before sending it, and worse, you do it for every request. If 100 people download a 100MB video at the same time, you’ll need 10 GB of memory on the server to serve them. That does not scale, not at all.

    A much better solution would be to send the file as its read from your CDN, using the readfile function. That way, you only need to use a small chunk of memory, and you can serve a lot more concurrent requests.

    EDIT : actually, you also need to respond with a special response code, the 206 partial content. I forgot that in the first version of this answer. Now fixed

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to run this page (video.php), I get the following error: Parse
Goal: To launch VLC player through PHP code, and play the specified video in
I found this PHP code in an app I have to modify... $links =
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);
I'm getting this PHP warning in my error_log and want to get it fixed.
Im using this PHP to get a list of Title's from an RSS feed:
I use a PHP script to validate video requests before serving them. This script
PHP + javascript code + flv player: I am trying to play a .flv
I followed this video tutorial but i am stuck.When i click on the login
I'm using this PHP code on a file to open a dialog box to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.