How to play .asf and .xesc video file on website? - javascript

I have two different video files. One is of .asf format and another is of .xesc format. How can I play these video files on my website?

The best solution is to upload it to a video-streaming service (such as YouTube) and play it on your website as an embed video. Then you do not have to worry about streaming the video - which can drag the speed of your entire website down.
However you can also convert the video to a supported HTML5 format and upload it to your server and use HTML5 builtin video player (not recommended).
You should use the video tag - HTML5 feature
<video height="500" width="500" controls>
<source src="source/of/the/video/" type="video/type" />
Can't play this video right now...
</video>
If you do not want to convert it, you may want to check out this answer

Related

Can not run video with link embed youtube

I can run video with link embed youtube.
My code:
<video id='my-video' class='video-js' controls preload='auto' width='640' height='264'
poster='' data-setup='{}'>
<source src='https://www.youtube.com/embed/fZ-yXDJJj5g'>
<p class='vjs-no-js'>
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href='https://videojs.com/html5-video-support/' target='_blank'>supports HTML5 video</a>
</p>
</video>
Video is show loading but don't play.
Please help me
As stated on the official repo, video.js doesn't support youtube video out of the box, you need to use a plugin for that:
It supports HTML5 and Flash video, as well as YouTube and Vimeo (through plugins)
So you'll have to use a plugin for that, like for example this one.
HTML5's video tag only works with video files. It doesn't work with Youtube video links(As those links do not point to source of video, instead they are a pointer to an HTML page). For that either you have to find storage link of video, which is not a good practice. Because Youtube can change that anytime. Better to use iframe for displaying Youtube video on your website.
You could just use tag then pass the src of the video. or even embed just like this.
<iframe id='my-video' class='video-js' width="640" height="264" src="https://www.youtube.com/embed/fZ-yXDJJj5g">
</iframe>
or
<embed id='my-video' class='video-js' width="640" height="264"
src="https://www.youtube.com/v/tgbNymZ7vqY">
then target those id to perform whatever you wanted to do.
I've encountered this problem, video tag does not work on this scenario.
So, I've research you can use iframe tag or embed then play with it into the script.

Loading video from database and playing video faster in website

I'm developing the html5 website user's can upload there videos and also they can watch the video through my website one problem i'm facing locally video's are loading faster without buffering can watch but i uploaded in to the google cloud it's taking time to load the videos and it's more time to buffering to play the video.
through the select query i'm fetching the video like
SELECT video FROM video i'm using mysql database.
<video class="embed-responsive-item" height="500" controls controlsList="nodownload">
<source src="<?php echo $u_pvid; ?>">
Your browser does not support the video tag.
</video>
give a feedback to how can i fix this issues from website...
you should select address of video from database not all contents.actually your video file should save in hard disk or use CDN and access them over videos address in your database.
also your internet speed specifies how fast video load and play.

How to play youtube video with default html5 controls?

I'm so sorry, but I can't get a youtube video to play (https://www.youtube.com/watch?v=SyRv0-oPfKE) inside a video tag.
I know about the iframe API but in this case it has to have the default html5 controls, not the youtube controls.
I probably missed something stupid but can't figure it out...
Anyone know how to do this?
EDIT:
so I tried:
<video
controls='controls'
src={`http://www.youtube.com/get_video_info?&video_id=${id}&asv=3&el=detailpage&hl=en_US`}
type='video/mp4'
/>
and tried:
<video
controls='controls'
src={`https://www.youtube.com/watch?v=SyRv0-oPfKE&html5=1`}
type='video/mp4'
/>
but I get blank page.
The HTML video element expects video files as a source. If you want to play a YouTube video using the native HTML video player, you'll have to provide a link to the video itself, not to the YouTube website for this video.
Also keep in mind, that not all browsers can handle any video formats. See MDN: Media formats for HTML audio and video.

Will it always be possible to play an audio file with the HTML5 <video> tag?

I've always noticed that you can play audio files with the HTML5 <video> tag. It seems really handy, considering that you only have to use 1 element to play videos and audio. An example would be this JSFiddle.
<video src="http://www.w3schools.com/html/horse.mp3" controls></video>
My first question is: Is this something that is here to stay, or is this a fluke that browsers plan on removing later on?
And if not, how do I know if a file is a video or audio using JavaScript? Because if I'm correct, can't .ogg files be video or audio? I'm trying to make a mediaplayer app for Chromebooks but I need to be able to differentiate audios from videos.

How to get a thumbnail from an embedded video?

I am trying to embed a video into a webpage using lightbox. From a design perspective, how should I place the video on the page.
I mean the videos are lined up across the page as thumbnails. Should I take a frame from the video and display that as an image that the user clicks? Or does the various video plugins take care of creating the thumbnail for you?
If you're using HTML5, the thumbnail of a video is defined using the 'poster' attribute in the video tag. Here's an example:
<video width="500" height="375" poster="myThumbnail.jpg" preload="none" controls="controls">
<source src="http://hostname.com/myVideo.webm"/>
</video>
If you want to create this image automatically using a given frame of the video, you should check the link posted by F. Calderan

Categories