Masking/redirecting a video URL via PHP - php

I'm desperately (hours of research and no luck so far) trying to create a PHP page which can be used as a path for video embedding. I'm doing this so that I can give out a path to 3rd parties, that they can use for embedding, which won't change, even if I have to host the video elsewhere.
I've tried using the code referenced here...
Reading mp4 files with PHP
... but it doesn't work at all for me.
The video files will be hosted on a CDN and 3rd parties will need fixed links that they can embed on their own sites like:
<div data-swf="$resourcePath/resources/flowplayer.commercial-5.4.3/flowplayer.swf" class="flowplayer is-splash play-button" data-ratio="0.5625">
<video>
<source type="video/mp4" src="http://www.mycdndomain.com/embed/loader.php?v=1"/>
</video>
</div>
Thanks in advance.
-Josh

Related

Revolution Slider video not play in iPhone

I use the video as a background. The background works well everywhere except the iPhone. I deleted the audio track, but it does not help. How can I play video on iPhone?
PHP CODE
<!-- BACKGROUND VIDEO LAYER -->
<div class="rs-background-video-layer"
data-forcerewind="on"
data-volume="mute"
data-videowidth="100%"
data-videoheight="100%"
data-videomp4="/wp-content/themes/SCALE/wp-content/uploads/2016/03/Working.mp4 "
data-videopreload="auto"
data-videoloop="loopandnoslidestop"
data-forceCover="1"
data-aspectratio="16:9"
data-autoplay="true"
data-autoplayonlyfirsttime="true"></div>
It seems that while the autoplay restriction is lifted for non-audio videos, if you have it in other versions there could be a conflict. You could try adding the property 'muted' or try the workaround suggested here: Can you autoplay HTML5 videos on the iPad?
Try to resize and compress your video to 7mb, then it may start to play.
It helped me, and for desktop I kept full video length.

How to show video with media player in codeigniter

How can I add media player in codeigniter,
I use below code, but still can't show the video :
<video width="205" height="180" controls>
<source src="application/views/web/videostreaming/video2.mp4" type="video/mp4" />
<source src="application/views/web/videostreaming/video2.ogv" type="video/ogg" />
<source src="application/views/web/videostreaming/video2.flv" type="video/flv" />
</video>
I added video sources in application/config/mimes.php like this:
'mp4' => 'video/mp4',
'flv' => 'video/flv',
'ogv' => 'video/ogv',
output error is:
No video with supported format and MIME type found
please help me to resolve this problem, thank you
Your error No video with supported format and MIME type found is a client-side issue, meaning that the browser cannot play any of your provided video files. Changing the CodeIgniter mime types isn't going to help you (unless perhaps you are processing all requests including those for static files through PHP). Check that your MP4 file is using H.264/AAC codices, and you OGV file is the Theora/Vorbis codicies and that these file paths are correct (you may want to dynamically create absolute paths using CodeIgniter's base_url() function).
The video tag is something new in html5 and doesn't support by browsers well.
i recommend you :
Flash (.swf) media player for html
Embed Tag

Stream video located outside the root

before i get burried in trying to create the code, I was hoping to get some advice before moving forward.
I am creating a video sharing app for a client.
The videos are highly confidential, so i want to store them outside the root and stream them when a user enters a link into a browser, which triggers a php script to access the file and play it.
Is this possible?
I can seem to find any info on any forums or Google.
Can I stream it direct to the browser?
I had this working when the files were inside the root.
I am holding the url of the file in a var:
$file_url = "../users/$u_id/$folder_name/$file_name";
And trying to stream the video using html5 player video.js using this:
<div id="video_box">
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="500" height="350"
poster="images/img_name.png"
data-setup='{"example_option":true}'>
<source src="$file_url" type='$file_type' />
</video>
</div>
Many thanks
Alan

How to embed an audio file into a website with php?

I am attempting to embed a sound file of Bohemian Rhapsody into my website and have found this code snippet:
echo "<embed src=\"SONGURL.mp3\" autostart=\"true\" loop=\"true\" hidden=\"true\"> </embed>\n" ."<noembed><bgsound src=\"SONGURL.mp3\" loop=\"infinite\"></noembed>";
My question is how to make this apply to the song I want? Also, what part of this would I modify?
Well it seems that the HTML snippet being produced by the PHP snippet in question relies on some sort of plug-in (my guess would be Flash, but I'm not familiar with Flash at all) so it would be much more complicated than a simple edit of the HTML string. If you're willing to break backwards compatibility with old browsers, you could use the HTML5 audio tag (see for example https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML5_audio_and_video).
In your case, given some filename $song_url, you could accomplish what it seems you want via string-building as
$html_snippet = "<audio src=\"$song_url\" autoplay loop></audio>";
echo $html_snippet;
To support multiple different formats (for example .ogg files for Firefox users) you can simply write
$html_snippet = <<<EOD
<audio autoplay loop>
Upgrade to a newer browser!
<source src="$song_url_mp3" type="audio/mpeg">
<source src="$song_url_ogg" type="audio/ogg">
</audio>
EOD;
This HTML tag will ensure that your audio plays automatically and loops forever. To give users standard music controls, simply add a controls attribute.

mp4 video doesn't play in video tag in html 5

Hi iam still struggling play mp4 format in video tag in html 5 here is my code
<?php
?>
<video width="560" height="340" controls>
<source src="http://ifliptips.com/admin/abc.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>
<?PHP
?>
here is link http://ifliptips.com/admin/VueGuides/video.php
can any one guide me what i wrong in this code.i try to play this link in chrome as well as IE9.
Thanks for advance.
There's a problem with the way you encoded your video. If you open your current video in VLC and go to Codec Information you'll see under video it says: Codec: mp4v but you're specifying the video codec is avc1.42E01E in your type attribute.
I don't know what codecs the browsers are restricted to playing, but if you convert your video
to avc1 (you can download a converted version here: http://www.online-convert.com/result/d1bb21daf90f8b77377d4c9f81398eff -- see it's codec info in VLC has changed to avc1) the browsers will play it.
Wayne

Categories