
file object as source
Is it possible to use a javascript file object as the source video for the player?
Is it possible to use a javascript file object as the source video for the player?
Hi there,
It would not be possible to use a JavaScript file as the content to be played in the player. For a list of the file formats we do support being played in JW Player, please see our Media Formats Reference.
Thank you!
That is not what I meant.
I meant if it is possible to inject a file OBJECT as a source to be played.
For example, if I upload a video file using an upload object, can I then use this as a source for the jwplayer?
Hi Benny,
My apologies for the miscommunication. Can you confirm that what you are trying to do is use the /videos/create endpoint of our API to upload a video and then embed that video in the player on your site?
Or are you saying that you would have a JavaScript object created through other means that you would then want to pass in to the player? If so, you can pass an object as part of either the playlist or sources block of your player configuration, as long as it contains the keys and values found in the tables on our JavaScript API Reference. The only required value is file.
For example, if your video file was found at http://yoursite.com/video.mp4, then you can pass in the following JavaScript object into the player:
var myPlaylist = {{ "file": "http://yoursite.com/video.mp4" }];
jwplayer("myElement").setup({ playlist: myPlaylist });
I hope that helps. Thank you.