Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Javascript video player for dash and mp4 videos, support multi subs , overlays and ads or information, injection mp4 video ads.

License

NotificationsYou must be signed in to change notification settings

medazzo/fjplayer

Repository files navigation

FOSSA StatusBuild Statusnpm version

fjplayer

What is fjplayer

  • it's a 100 % customiazble video player base on html 5 video Player
  • it's support dash and mp4 sources
  • it support multi subs tracks
  • it support overlays ads and any information overlays
  • it support injection mp4 video ads in preroll,modroll or after rolling main video
  • based on sdhakla player

Using fjplayer

include fjplayer file

dist/fjplayer.js for fjplayer styles and javascript code , no other dependecies is needed

<scripttype="text/javascript"src="/dist/fjplayer.min.js"></script>

html

In your html code , you need to add a div with a an Id to be used bu the player

<divid="playercontainer"></div>

java script coding

In order to create a player and use , we need to create a playlist first :

varplaylist=newfjplayer.Playlist();

Then specify one or more elements and add them to the playlist

varforjaItemDashEncryptedWithPreAds={'FJType':'dash','FJTitle':'clear Forja movie itemDash ','FJClass':'vod','FJSrc':'http://127.0.0.1:8500/dashedCrypted/stream.mpd','FJDrm':{"FjLicenseServer":"http://127.0.0.1:3000"},'FJAds':[{'FJType':'video/mp4','FJSrc':'../videos/berber_pub.mp4','FJClass':'pre-roll','FJCanEscape':true,'FJUrl':'http://www.google.com'}]};varMp4SubsWithThumbs={'FJSrc':'https://content.jwplatform.com/videos/q1fx20VZ-kNspJqnJ.mp4','FJTitle':' title of movie itemOnly 1','FJClass':'vod','FJThumbs':'../vtt/thumbs.vtt','FJType':'video/mp4','FJSubtitles':[{'FJLabel':'English','FJLang':'en','FJSrc':'../vtt/sintel-en.vtt'},{'FJLabel':'Espagnol','FJLang':'es','FJSrc':'../vtt/sintel-es.vtt'},{'FJLabel':'Deutsch','FJLang':'de','FJSrc':'../vtt/sintel-de.vtt'}]};varclearSteam={'FJType':'dash','FJTitle':'clear Forja movie itemDash ','FJClass':'vod','FJSrc':'http://127.0.0.1:8500/bclear/stream.mpd'}playlist.addItem(Mp4SubsWithThumbs);playlist.addItem(clearSteam);

Now , you can create player where first argument is the playerKey and the second is the id of the div container in html and load the playlist;

varplayer=newfjplayer.Player('fjserverID1','playercontainer');player.loadPlaylist(playlist);

You can also add event listener ;

functionfjplayerEvent(e,args){console.warn(" We are having an event : ",e,args);};player.on(fjplayer.PlayerEvents.STREAM_LOADED,fjplayerEvent);

Finally, you can start playing , in this example we start play at element 0, looping is true , random play id false and autostart is true ;

player.startPlaylist(0,true,false,true);

fjplayer Developing

Setup

cd fjplayernpm install

Build min files

npm run build

Test

Tests are run with Jest and Karma, to run tests :

npm test

You can run tests with coverage or tests while watchinf code sources changes :

npm run test:coveragenpm run test:watch

At the end of the run , result of coverage will be displayed.

Build docs

To build docs , run :

npm run doc

Docs will be generated underdocs/generated,use browser on the index file :

firefox  docs/generated/index.html

Run demo

To run http demo and developiong watching mode for javascript code :

npm run live

Demo app will be launched athttp://localhost:8080

Demo application

Playlist Item

A Playlist item will contains theses elements :

item fieldmandatoryvalueDescription
FJClassYES'vod' or 'live'the class of the stream
FJTypeYES'video/mp4' or 'dash'the type of the stream
FJTitleYESnon empty stringthe title to be shown when playing
FJSrcYESnon empty url stringthe url of the stream to be played
FJDownloadNOnon empty url stringactivate download icon and open new widown on url when icon is clicked
FJShareNOnon empty url stringactivate share icon and open new widown on url when icon is clicked
FJBackNOnon empty url stringactivate back arow icon and locate current window to url when icon is clicked
FJUpTitleNObooleanshow of not the title in player up
FJSrcYESnon empty url stringthe url of the stream to be played
FJDrmNOintegerit's an object containing drm security information
FJPosterNOurl to image posterurl to poster to be showing wen loading
FJThumbsNOurl to image thumbsurl to file containing tooltip thumbnail images for video associated with WebVTT : to generate this file you can visitgithub video scripts
FJSubtitlesNOarray of subtitles Items
FJAdsNOarray of video ads Items
FJOverlaysNOarray of overlays Items

fjplayerads

The object ads , must be inserted on arrayFJAds under item on playlist.The Ads is referring to advertissment.When it's time to play this ads , fjplayer will pause main video hide the controls , play the Ads and show a transparent banner up on which the countdown timer before the ads ends.

Ads also contains :

ads item fieldmandatoryvalueDescription
FJTypeYES'video/mp4' or 'dash'the type of the stream
FJSrcYESnon empty url stringthe url of the stream to be played
FJClassYES'pre-roll' , 'mid-roll' or 'post-roll'pre: before main video, mid: in the middle and post: after the main video
FJCanEscapeYESbooleandisplay a button to escape ads or not
FJFJUrlSrcYESnon empty url stringthe url of the advertiser, when user click on video when ads playing , a windows will be opened on this url
FJShowAtYES (mid-roll)integerthe number of seconds use to start the Ads if it mid-roll class

ifFJShowAt is negatif or bigger than ads duration , then the concerned ads wil not be player.

fjplayersubtitle

The object subtitle , must be inserted on arrayFJSubtitles under item on playlist.It permit to add a webvtt subtitles other that existing in mpd (in case of dash ) .it contains :

subtitle fieldmandatoryvalueDescription
FJLabelYESnon empty stringstring label of subtitles to be shown on control
FJSrcYESnon empty url stringurl of the web vtt subtitles file
FJLangYESfr or en or de ...ISO descripton of language

fjplayeroverlay

The object overlay , must be inserted on arrayFJOverlays under item on playlist.An overlay is a graphic layer above the video layer that conatains data like ads data.When user lick on an overlay a new opened will be opened with the urlFJOverUrl.Ii will be showing atFJOverShowAt and for a duration ofFJOverDuration .IfFJOverShowAt orFJOverShowAt+FJOverDuration is bigger than the item movie duration, then the overlays will not be schown at all .it contains :

overlay fieldmandatoryvalueDescription
FJDataYESnon empty stringhtml data that will be putted on div overlay
FJUrlYESnon empty url stringurl to open in new window to when the user click on overlay
FJDurationYESintegerin seconds , the duration of overlay show
FJShowAtYESintegerin seconds , the time in video to start to schow the overlay

fjplayerdrm

This part of specs is not supported yet by playerThe object drm , is referring to Digital right managment and it's contains data about media drm .This object is managed onlywhenFJType isdash .It must be inFJDrm fieldit contains :

drm fieldmandatoryvalueDescription
FJDrmSchemeYES'forja','playReady,'clearKey' or 'widevine'drm Scheme to use
FJLicenceServerYESnon empty url stringurl of the Licensing server
FJHeadersOnLicenseRequestNOobject contains headers and valueheaders and value to be add to request when asking for license
FJHeadersOnSegmentsRequestNOobject contains headers and valueheaders and value to be add to request when asking for segment

The Drm schemefjserver is a clear key based scheme done onfjserver .

About

A Javascript video player for dash and mp4 videos, support multi subs , overlays and ads or information, injection mp4 video ads.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp