Ok, we have a server with hundreds of videos (from a local tv station) and we are making a small website for the videos to be shown using RTMP and a MySQL database. All the video names are stored in the database and we use PHP to show the names in a list and make them clickable (onClick to add the video to player). I have got this working but now we would like to add a small pre-roll before every video. It's a small clip showing our logo for a few seconds.
Let's say I have a playlist like this:
Pre-roll video
Main video
Then I want to click a link (which is generated from my MySQL database) to change the second video to some other video:
Pre-roll video (same as before)
Main video (new)
And then load the playlist and play it from the beginning.
All this using RTMP.
Is this possible?
I got it working using a PHP variable as the second video.
Related
I am unable to load a HTML video element (from AWS S3) in webm format and use the timeline to scrub along it. The timeline works once the whole video has played once.
Is there a way of being able to use it from the start?
I can't tell if it is a problem server or client side.
Below is an example of the video and how it looks throughout the first play.
I have 2 video players on single page. On desktop, everything works fine, both video players are playing videos. But when I try to cast this page to Chromecast (via Google Chrome extension or via https://demille.github.io/url-cast-receiver/), only first video player is active and playing, second video player is not working.
I tried to debug it and it looks like second video ends at video readyState=1 (first video has readyState=4)
Is there way to fix this? (I need multiple video players on single page, so using only one player and switching video files URLs is not a solution)
URL: http://iuvomedia.eu/chromecast/
If you want one video to play and other to be pre-loaded then you should make a queue of videos you want to play. Chromecast will play single video at a time and when it ends it'll automatically load the next one in the queue.
For information on autoplay and queuing you may visit https://developers.google.com/cast/docs/autoplay
You cannot have more than one active media element.
I mean, you can have two media elements where one plays a video that doesn't have any audio and the second one plays only audio.
You cannot have two active video or two active audio pipelines at the same time.
check here: Create multiple instances of html video object
Is it possible to play video online that's made of two or more video files?
Since my original post wasn't clear enough, here's expanded explanation and question.
My site is hosted on Linux/Apache/PHP server. I have video files in FLV/F4V format. I can also convert them to other available formats if necessary. All videos have same aspect ratio and other parameters.
What I want is to build (or use if exist) online video player that plays video composed of multiple video files concatenated together in real-time, i.e. when user clicks to see a video.
For example, visitor comes to my site and sees video titled "Welcome" available to play. When he/she clicks to play that video, I take video files "Opening.f4v", "Welcome.f4v" and "Ending.f4v" and join/merge/concatenate them one after another to create one continuous video on the fly.
Resulting video looks like one video, with no visual clues, lags or even smallest observable delay between video parts. Basically what is done is some form of on-the-fly editing or pre-editing, and user sees the result. This resulting video is not saved on the server, it's just composed and played that way real-time.
Also, if possible, user shouldn't be made to wait for this merging to be over before he/she sees resulting video, but to be able to get first part of the video playing immediately, while merging is done simultaneously.
Is this possible with flash/actionscript, ffmpeg, html5 or some other online technology? I don't need explanation how it's possible, just a nod that it's possible and some links to further investigate.
Also, if one option is to use flash, what are alternatives for making this work when site is visited from iphone/ipad?
An approach that will work on some browsers currently, and on most browsers going forwards is to use the HTML5 Video Media Source Extension mechanism.
This essentially allows you replace a static 'src' file for a video in your HTML5 page, with a dynamic src buffer which you can then fill any way you want using your own Javascript code.
So you can write code to pre-buffer the second video when you get towards the end of the first video and then immediately start adding packets from the second video to the src right after the last packet for the first video.
In very high level terms this looks like:
Your HTML to insert the video where you want it in your page:
.
.
.
<div>
<video id="yourVideo1" controls="" autoplay="" width="320" height="240"></video>
</div>
.
.
.
Your Javascript to provide the source for your video:
//Get the video element
var videoElement = document.getElementById('yourVideo1');
//Create a 'MediaSource' and associate it with this video
var mediaSource = new MediaSource();
video.src = window.URL.createObjectURL(mediaSource);
//Add a listener to the MediaSource object to check for
//the video been opened. In this function you can add your
//code to get the get your videos from the servers and add
//'chunks' to the media source buffer
mediaSource.addEventListener('sourceopen', function(e) {
//Set the format of the source video
var mediaSourceBuffer = mediaSource.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
//Get your video from the web
while (not the end of your video playlist) {
...
//Stream video from server
...
//Add packets received to the media source bufer
mediaSourceBuffer.appendBuffer(receivedVideoPackets);
//If near end of video start fetching next video to
//avoid buffering delay
...
//If end of video go to next video in playlist
...
}
}, false);
Look at the HTML5 Rocks demo below to see this in action (for a slightly different usecase).
Given how tricky video manipulation is and the multitude of formats etc, it would be much easier for you if one of the established video players provided the functionality out of the box so I would still try their forums as mentioned in the comment, but at least you know it is technically possible.
The MSE spec is available here:
http://w3c.github.io/media-source/
And a good intro blog and demo is here (make sure your browser supports MSE - latest version of Chrome does):
http://updates.html5rocks.com/2011/11/Stream-video-using-the-MediaSource-API
You can find latest browser support here:
http://www.jwplayer.com/html5/mediasource/
Use two video elements, first visible and second display:none for buffering.
After first video playing, check currentPosition and currentDuration,
specify second video preloader prepare visible video player's buffer data.
First video element's SRC could be specified anytime for seamless playing.
I'm using the flvplayback component in an AS3 movieclip. I do have the source defined in the compontents properties to a video hosted on Amazon s3.
Now the problem is as soon as the swf loads in a browser it starts downloading/buffering the video even though it's not set to autoplay.
Is it possible to only have it start downloading if the play button is clicked (I do have a custom play button hooked up to player via AS3)? I have 3 separate video players in the swf each with fairly large videos and I don't really want to burn through a ton of bandwidth especially if the user only plays one video.
Thanks!
I haven't used the flvplaybackcomponent, but I'm assuming as soon as you specify a url, it'll start downloading. Try either not setting that until it's been interacted with, or -- do what everyone else does -- place an clickable image on top, then once that's done, create your video player.
I have one video file inmy system I want it to attach it on my html page.I want same thing with youtube videos also.I want that when i open my html form this video appear as like same as pictures are seen at thumnails.means i dont want only links..I tried stackoverflow links but no one is telling from starting .I am telling u frankly i dont know even making a link of my sytem video file in html form,..I can make links for image,files etc but for video si dont know.So plz guide ..
1.HOw to make a simple link of video file which is in my system drive.
2.HOw this video will be displayed like pictures are displayed at thumbnails
3.How to upload youtube videos(not want only link)...
If you have a video file then you need an image to represent your thumbnail. To create a link that will allow someone to download the video is as simple as:
<a href="url of your video file">
<img src="url of the thumbnail image"/>
</a>
Then the user will see the thumbnail image and when they click on it they will get the video. If you wish to embed the video in a player you can select the player of choice such as FlowPlayer or any of a million others.
You question about you-tube I assume you mean to embed you-tube videos on yout site. If that is the case visit the video on you-tube and there is an embed text box on the page with the code that you must copy and paste into your site.
EDIT:
The FlowPlayer that I linked to (not an endorsement) has a page that describes in great detail how to do what you are asking for here. If you follow each step then you will get exactly what you envision.
Another Edit:
To play a particular file format you need to use an appropriate player. I do not know all the players but you want to make sure that the format you use is popular enough so that users do not have to download special plugins just to see your video.
If you visit the DivX website you will find their embeddable player that can play mkv files on your website. They have a Code Generator that produces the code that you will use to embed the player on your site.
As for various options like starting in pause mode etc you will have to read the documentation of the player that you use to see what options they allow.
you an download ny video from youtube and these videos are in .flv format so why u are taking tension.Just use them frequently.And for youtube videos u do not need to use flowplay just add youtube video url and add object that will be given in that page just above the related video..
But me too do not how to allign it on right side or in middle of the page..Can anybody tell..