MeetHour-Java-Example

Alt text

Meet Hour - 100% free video conference solution Meet Hour is 100% free video conference solution with End to End Encrypted and many other features such as lobby mode, Donor box & Click&Pledge Connect for fundraising, Video call recording, Youtube Live Stream etc.

Features:

✅ Free Unlimited Time Group Video Conference

✅ Upto 100 Participants Group Meeting

✅ Free Video Conference Recording

✅ YouTube Live Stream

✅ Raise funds via Click&Pledge Connect & DonorBox

✅ Virtual Background

✅ Live Pad

✅ Screensharing on Desktop & Mobile and many other features.

Try out one free session -

1. Website - https://meethour.io
2. Android - https://bit.ly/2U239ll
3. iOS - https://apple.co/3k8Rpbn

Alt text

MeetHour API Documentation

API Documentation Link - https://docs.v-empower.com/docs/MeetHour-API/

Meet Hour Java Example

    https://github.com/v-empower/MeetHour-Web-MobileSDKs/tree/master/Java/Core-Java

Maven Repo

    https://repo.meethour.io/maven/releases/go/meethour/io/javasdk/meethour_sdk/

Install

  <dependencies>
    <dependency>
      <groupId>go.meethour.io.javasdk</groupId>
      <artifactId>meethour_sdk</artifactId>
      <version>1.0.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


    <repositories>
        <repository>
            <id>meethour-repo</id>
            <url>https://repo.meethour.io/maven/releases/</url>
        </repository>
    </repositories>

API Usage

Provide your credentials in the constructor of Login object and hit the login api to get your access token. Which will further be used for making rest of the api calls.

<%@ page import="go.meethour.io.javasdk.services.ApiServices"%>
<%@ page import="go.meethour.io.javasdk.types.LoginType"%>
<%@ page import="go.meethour.io.javasdk.types.GenerateJwt" %>
<%@ page import="go.meethour.io.javasdk.types.ViewMeeting" %>
<%@ page import="go.meethour.io.javasdk.types.ScheduleMeetingType" %>
<%@ page import="org.json.JSONObject" %>
<%
 String  CONFERENCE_URL = "meethour.io";
 String GRANT_TYPE = "password";
 String GRANT_REFRESH_TYPE = "refresh_token";
 String BASE_URL = "https://api.meethour.io";
 String API_VERSION = "v1.2";
 String API_RELEASE = "v2.4.6";

 String CLIENT_ID = "";
 String CLIENT_SECRET = "";
 String API_KEY = "";
 String EMAIL = "";
 String PASSWORD = "";
 ApiServices apiServices = new ApiServices();

 LoginType loginDetails = new LoginType(CLIENT_ID,CLIENT_SECRET, GRANT_TYPE,EMAIL, PASSWORD);
 String loginresponse = apiServices.login(loginDetails);

 JSONObject responsesObject = new JSONObject(loginresponse);
 String access_token = responsesObject.getString("access_token");

 String meeting_name = "API Calls";
 String passcode = "123456789";
 String timezone = "Asia/Kolkata";
 String meeting_date = "23-06-2030";
 String meeting_time = "10:00";
 String meeting_meridiem = "PM";
 int send_calendar_invite = 1;
 int is_show_portal = 1;
 String options=null;
 String attend=null;
 String hostusers=null;

ScheduleMeetingType meeting = new ScheduleMeetingType(meeting_name, passcode, meeting_time, meeting_meridiem,meeting_date, timezone, 1, 1,  null,null,null);
String scheduleObject = apiServices.schedulemeeting(meeting, access_token);
JSONObject scheduleresponses = new JSONObject(scheduleObject);

JSONObject data = scheduleresponses.getJSONObject("data");

String meeting_id = data.getString("meeting_id");

String pCode = data.getString("pcode");



ViewMeeting view = new ViewMeeting(meeting_id);
String viewObject = apiServices.viewmeeting(view, access_token);
String viewmeetingResponse=viewObject;

GenerateJwt jwt = new GenerateJwt(meeting_id);
String jwtObject = apiServices.generatejwt(jwt, access_token);
JSONObject jwtresponses = new JSONObject(jwtObject);
String JwtToken = jwtresponses.getString("jwt");


%>


<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <style>
            html, body {
                height: 100%;
                margin: 0;
                padding: 0;
                overflow: hidden;
            }
            #conference-parent {
                height: 100%;
            }
        </style>
    </head>
<body>
    <script type="text/javascript" src="https://api.meethour.io/libs/<%= API_RELEASE %>/external_api.min.js?apiKey=<%= API_KEY %>"></script>
    <div class="relative" id="conference-parent"></div>
    <script type="text/javascript">
        try {
            const conferencePanel = document.createElement("div");
            conferencePanel.setAttribute("id", "conference");
            conferencePanel.setAttribute("style", "height: 100%;");
            const meetingPanel = document.querySelector("#conference-parent");
            meetingPanel.appendChild(conferencePanel);
            var domain = "<%= CONFERENCE_URL %>";
            var options = {
                roomName: "<%= meeting_id %>",
                parentNode: document.querySelector("#conference"),
                jwt: "<%= JwtToken %>",
                apiKey: "<%= API_KEY %>",
                pcode: "<%= pCode %>",
                interfaceConfigOverwrite: {
                    applyMeetingSettings: true,
                    disablePrejoinHeader: true,
                    disablePrejoinFooter: true,
                    SHOW_MEET_HOUR_WATERMARK: false,
                    ENABLE_DESKTOP_DEEPLINK: false,
                    HIDE_DEEP_LINKING_LOGO: true,
                    MOBILE_APP_PROMO: false,
                    ENABLE_MOBILE_BROWSER: true,
                },
            };
            var api = new MeetHourExternalAPI(domain, options);
        } catch (error) {
            console.log(error);
        }
    </script>
</body>
</html>

API End Points Supported

Important points: => Instead of '{version}', you to pass our latest version whenever you call the given functions. Currently we are using v1.2 Same version applies to the below calls. => In the token section, you need to pass the received access token which is received when login api is hit, for making further api calls. => You can make API calls by passing required properties in the constructor. But, to meet special requirements you can set rest of the properties directly, according to your need. For more details go to https://docs.v-empower.com/docs/MeetHour-API then click on APIS section to get all the information related to each api call.

  1. To Get Access Token Endpoint : => https://docs.v-empower.com/docs/MeetHour-API/a44a7d7669f91-user-login-get-access-token
         import go.meethour.io.javasdk.types.LoginType;
         LoginType loginDetails = new LoginType(CLIENT_ID,CLIENT_SECRET, GRANT_TYPE,EMAIL, PASSWORD); # pass values
         ApiServices apiServices = new ApiServices();
         String login_response = apiServices.login(loginDetails);
         System.out.println(login_response);
    
    => You have to pass respective values in the argument section. Hence, to get desired response.
  2. To schedule a meeting: => https://docs.v-empower.com/docs/MeetHour-API/2de4b757a6312-meeting-schedule-meeting
        import go.meethour.io.javasdk.types.ScheduleMeetingType;
         ScheduleMeetingType meeting = new ScheduleMeetingType(meeting_name, passcode, meeting_time, meeting_meridiem,meeting_date, timezone, 1, 1,  null,null,null); #pass value
         ApiServices apiServices = new ApiServices();
         String schedule_meeting_response = apiServices.schedulemeeting(meeting, access_token);
         System.out.println(schedule_meeting_response);
    
  3. To Generate JWT Token Endpoint => https://docs.v-empower.com/docs/MeetHour-API/b7e3d0ab3906f-generate-jwt
         import go.meethour.io.javasdk.types.GenerateJwt;
         GenerateJwt jwt = new GenerateJwt(meeting_id); # pass values
         ApiServices apiServices = new ApiServices();
         String schedule_meeting_response = apiServices.schedulemeeting(meeting, access_token);
         String generate_jwt_response = apiServices.generatejwt(jwt, access_token);
         System.out.println(generate_jwt_response);
    
  4. To fetch User Details: => https://docs.v-empower.com/docs/MeetHour-API/ff9d0e37d9191-user-details
         import go.meethour.io.javasdk.types.UserDetails;
         UserDetails user = new UserDetails();
         ApiServices apiServices = new ApiServices();
         String user_details_response = apiServices.userdetails(user, access_token);
         System.out.println(user_details_response);
    
  5. To fetch access Token using Refresh Token: => https://docs.v-empower.com/docs/MeetHour-API/d851be1af9804-get-access-token-using-refresh-token
        import go.meethour.io.javasdk.types.RefreshToken;
        ApiServices apiServices = new ApiServices();
        RefreshToken refresh = new RefreshToken(CLIENT_ID,CLIENT_SECRET,refresh_token,access_token); #pass values
        String refresh_token_response = apiServices.refreshtoken(refresh);
        System.out.println(refresh_token_response);
  1. To add a contact in Meet Hour database: => https://docs.v-empower.com/docs/MeetHour-API/bd1e416413e8c-add-contact
        import go.meethour.io.javasdk.types.AddContactType;
        AddContactType contactDetails = new AddContactType(EMAIL,Fristname,lastname,phone,country_code,Image,true); #pass values
        ApiServices apiServices = new ApiServices();
        String add_contact_response = apiServices.addcontact(contactDetails, access_token);
        System.out.println(add_contact_response)
  1. To get Timezones of various countries: => https://docs.v-empower.com/docs/MeetHour-API/c688c29bce9b9-timezone-list
         import go.meethour.io.javasdk.types.TimeZone;
         TimeZone time = new TimeZone();
         ApiServices apiServices = new ApiServices();
         String timeZone_response = apiServices.timeZone(time, access_token);
         System.out.println(timeZone_response)
    
  2. To get list of all the contacts in your Meet Hour account: => https://api.meethour.io/api/{version}/customer/contacts
         import go.meethour.io.javasdk.types.ContactsType;
         ContactsType contactObjects = new ContactsType(null, null, null);
         ApiServices apiServices = new ApiServices();
         String contacts_response = apiServices.contacts(contactObjects, access_token);
         System.out.println(contacts_response)
    
  3. To make changes in the existing contact details: => https://docs.v-empower.com/docs/MeetHour-API/28cae9187d215-edit-contact
         import go.meethour.io.javasdk.types.EditContactType;
         EditContactType contacts = new EditContactType(id,country_code,EMAIL, Firstname,lastname,Image,true,phone) # pass values
         ApiServices apiServices = new ApiServices();
         String edit_contacts_response = apiServices.editcontact(contacts, access_token);
         System.out.println(edit_contacts_response)
    
  4. To get Upcoming Meetings: => https://docs.v-empower.com/docs/MeetHour-API/31df88388416d-upcoming-meetings
        import go.meethour.io.javasdk.types.UpcomingMeetings;
        UpcomingMeetings upcomingmeeting = new UpcomingMeetings(null, null, null);
        ApiServices apiServices = new ApiServices();
        String upcoming_meetings_response = apiServices.upcomingmeeting(upcomingmeeting, access_token);
        System.out.println(upcoming_meetings_response)
    
  5. To archive a meeting: => https://docs.v-empower.com/docs/MeetHour-API/1dd64523cc6bf-archive-meeting
        import go.meethour.io.javasdk.types.ArchiveMeetings;
        ArchiveMeetings archive = new ArchiveMeetings(id);  # pass values
        ApiServices apiServices = new ApiServices();
        String ArchiveMeeting_response = apiServices.archivemeetings(archive, access_token);
        System.out.println(ArchiveMeeting_response);
    
  6. To get the details of a missed meeting: => https://docs.v-empower.com/docs/MeetHour-API/92998e2dda102-missed-meetings
        import go.meethour.io.javasdk.types.MissedMeetings;
        MissedMeetings missed = new MissedMeetings(null, null, null);
        ApiServices apiServices = new ApiServices();
        String missed_meetings_response = apiServices.missedmeeting(missed, access_token);
        System.out.println(missed_meetings_response)
    
  7. To get completed meetings: => https://docs.v-empower.com/docs/MeetHour-API/aa9ef6a678250-completed-meetings
        import go.meethour.io.javasdk.types.CompletedMeetings;
        CompletedMeetings completedmeeting = new CompletedMeetings();
        ApiServices apiServices = new ApiServices();
        String completed_meetings_response = apiServices.completedmeeting(completedmeeting, access_token);
        System.out.println(completed_meetings_response);
    
  8. To edit an existing meeting: => https://docs.v-empower.com/docs/MeetHour-API/5dedde36380b4-meeting-edit-meeting
        import go.meethour.io.javasdk.types.EditMeeting;
        EditMeeting editmeeting = new EditMeeting(meeting_id);  # pass values
        ApiServices apiServices = new ApiServices();
        String edit_meeting_response = apiServices.editmeeting(editmeeting, access_token);
        System.out.println(edit_meeting_response)
    
  9. To view a meeting: => https://docs.v-empower.com/docs/MeetHour-API/7e9a0a1e0da7f-meeting-view-meeting
        import go.meethour.io.javasdk.types.ViewMeeting;
        ViewMeeting view = new ViewMeeting(meeting_id);  # pass values
        ApiServices apiServices = new ApiServices();
        String view_meetings_response = apiServices.viewmeeting(view, access_token);
        System.out.println(view_meetings_response)
    
  10. To get all the recordings list: => https://docs.v-empower.com/docs/MeetHour-API/ce7c4fd8cae7e-recording-list
        import go.meethour.io.javasdk.types.RecordingsList;
        RecordingsList record = new RecordingsList("Local", 0, 0);  # pass values
        ApiServices apiServices = new ApiServices();
        String recordings_list_response = apiServices.recordingList(record, access_token); # storage location
        System.out.println(recordings_list_response)
    

Join Meeting via Javascript SDK

        <script src="https://api.meethour.io/libs/v2.4.6/external_api.min.js?apiKey=f6282h82729080282928298"></script>

api = new MeetHourExternalAPI(domain, options)

Config & User Interface Settings Parameters - Parameters - https://docs.v-empower.com/docs/MeetHour-API/281f2d9a6c539-generate-jwt

The next step for embedding Meet Hour is to create the Meet Hour API object. Its constructor gets a number of options:

```Javascript Standard Example for Conference


Example:

```javascript
const domain = "meethour.io";
const options = {
  roomName: "MeetHourExternalAPI",
  width: 700,
  height: 700,
  parentNode: document.querySelector("#meet"),
};
const api = new MeetHourExternalAPI(domain, options);

You can set the initial media devices for the call:

const domain = 'meethour.io';
const options = {
    ...
    devices: {
        audioInput: '<deviceLabel>',
        audioOutput: '<deviceLabel>',
        videoInput: '<deviceLabel>'
    },
    ...
};
const api = new MeetHourExternalAPI(domain, options);

You can overwrite options set in [config.js] and [interface_config.js]. For example, to enable the filmstrip-only interface mode, you can use:

const options = {
    ...
    interfaceConfigOverwrite: { filmStripOnly: true },
    ...
};
const api = new MeetHourExternalAPI(domain, options);

You can also pass a jwt token to Meet Hour:

const options = {
   ...
   jwt: '<jwt_token>',
   noSsl: false,
   ...
};
const api = new MeetHourExternalAPI(domain, options);

You can set the userInfo(email, display name) for the call:

var domain = "meethour.io";
var options = {
    ...
    userInfo: {
        email: 'email@meethourexamplemail.com',
        displayName: 'John Doe'
    }
}
var api = new MeetHourExternalAPI(domain, options);

Controlling the embedded Meet Hour Conference

Device management MeetHourExternalAPI methods:

api.getAvailableDevices().then(devices => {
    devices = {
        audioInput: [{
            deviceId: 'ID'
            groupId: 'grpID'
            kind: 'audioinput'
            label: 'label'
        },....],
        audioOutput: [{
            deviceId: 'ID'
            groupId: 'grpID'
            kind: 'audioOutput'
            label: 'label'
        },....],
        videoInput: [{
            deviceId: 'ID'
            groupId: 'grpID'
            kind: 'videoInput'
            label: 'label'
        },....]
    }
    ...
});
api.getCurrentDevices().then(devices => {
    devices = {
        audioInput: {
            deviceId: 'ID'
            groupId: 'grpID'
            kind: 'videoInput'
            label: 'label'
        },
        audioOutput: {
            deviceId: 'ID'
            groupId: 'grpID'
            kind: 'videoInput'
            label: 'label'
        },
        videoInput: {
            deviceId: 'ID'
            groupId: 'grpID'
            kind: 'videoInput'
            label: 'label'
        }
    }
    ...
});
// The accepted deviceType values are - 'output', 'input' or undefined.
api.isDeviceChangeAvailable(deviceType).then(isDeviceChangeAvailable => {
    ...
});
api.isDeviceListAvailable().then(isDeviceListAvailable => {
    ...
});
api.isMultipleAudioInputSupported().then(isMultipleAudioInputSupported => {
    ...
});
api.setAudioInputDevice(deviceLabel, deviceId);
api.setAudioOutputDevice(deviceLabel, deviceId);
api.setVideoInputDevice(deviceLabel, deviceId);

You can control the embedded Meet Hour conference using the MeetHourExternalAPI object by using executeCommand:

api.executeCommand(command, ...arguments);

The command parameter is String object with the name of the command. The following commands are currently supported:

api.executeCommand("displayName", "New Nickname");
api.executeCommand("password", "The Password");
api.executeCommand("sendTones", {
  tones: string, // The dial pad touch tones to play. For example, '12345#'.
  duration: number, // Optional. The number of milliseconds each tone should play. The default is 200.
  pause: number, // Optional. The number of milliseconds between each tone. The default is 200.
});
api.executeCommand("subject", "New Conference Subject");
api.executeCommand("toggleAudio");
api.executeCommand("toggleVideo");
api.executeCommand("toggleFilmStrip");
api.executeCommand("toggleChat");
api.executeCommand("toggleShareScreen");
api.executeCommand("toggleTileView");
api.executeCommand("hangup");
api.executeCommand("email", "example@example.com");
api.executeCommand(
  "avatarUrl",
  "https://avatars0.githubusercontent.com/u/3671647",
);
api.executeCommand("receiverParticipantId", "text");
api.executeCommand("setVideoQuality", 720);

You can also execute multiple commands using the executeCommands method:

api.executeCommands(commands);

The commands parameter is an object with the names of the commands as keys and the arguments for the commands as values:

api.executeCommands({
  displayName: ["nickname"],
  toggleAudio: [],
});

You can add event listeners to the embedded Meet Hour using the addEventListener method. NOTE: This method still exists but it is deprecated. MeetHourExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods (addListener or on).

api.addEventListener(event, listener);

The event parameter is a String object with the name of the event. The listener parameter is a Function object with one argument that will be notified when the event occurs with data related to the event.

The following events are currently supported:

{
    type: string, // A constant representing the overall type of the error.
    message: string // Additional information about the error.
}
{
    id: string, // the id of the participant that changed his avatar.
    avatarURL: string // the new avatar URL.
}
{
  available: boolean; // new available status - boolean
}
{
  muted: boolean; // new muted status - boolean
}
{
    senderInfo: {
        jid: string, // the jid of the sender
        id: string // the participant id of the sender
    },
    eventData: {
        name: string // the name of the datachannel event: `endpoint-text-message`
        text: string // the received text from the sender
    }
}
{
    type: string, // A constant representing the overall type of the error.
    message: string // Additional information about the error.
}
{
    on: boolean, //whether screen sharing is on
    details: {

        // From where the screen sharing is capturing, if known. Values which are
        // passed include 'window', 'screen', 'proxy', 'device'. The value undefined
        // will be passed if the source type is unknown or screen share is off.
        sourceType: string|undefined
    }
}
{
  id: string; //participantId of the new dominant speaker
}
{
    enabled: boolean, // whether tile view is not displayed or not
}
{
    from: string, // The id of the user that sent the message
    nick: string, // the nickname of the user that sent the message
    message: string // the text of the message
}
{
  message: string; // the text of the message
}
{
    id: string, // the id of the participant that changed his display name
    displayname: string // the new display name
}
{
  devices: Object; // the new list of available devices.
}

NOTE: The devices object has the same format as the getAvailableDevices result format.

{
    id: string, // the id of the participant that changed his email
    email: string // the new email
}
{
  error: string; // The error which occurred during submission, if any.
}
{
  visible: boolean; // Whether or not the filmstrip is displayed or hidden.
}
{
    id: string, // the id of the participant
    displayName: string // the display name of the participant
}
{
    kicked: {
        id: string, // the id of the participant removed from the room
        local: boolean // whether or not the participant is the local particiapnt
    },
    kicker: {
        id: string // the id of the participant who kicked out the other participant
    }
}
{
  id: string; // the id of the participant
}
{
  id: string; // the id of the participant
  role: string; // the new role of the participant
}
{
    roomName: string, // the room name of the conference
    id: string, // the id of the local participant
    displayName: string, // the display name of the local participant
    avatarURL: string // the avatar URL of the local participant
}
{
  roomName: string; // the room name of the conference
}
{
  available: boolean; // new available status - boolean
}
{
  muted: boolean; // new muted status - boolean
}
{
  subject: string; // the new subject
}

You can also add multiple event listeners by using addEventListeners. This method requires one argument of type Object. The object argument must have the names of the events as keys and the listeners of the events as values. NOTE: This method still exists but it is deprecated. MeetHourExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods.

function incomingMessageListener(object) {
  // ...
}

function outgoingMessageListener(object) {
  // ...
}

api.addEventListeners({
  incomingMessage: incomingMessageListener,
  outgoingMessage: outgoingMessageListener,
});

If you want to remove a listener you can use removeEventListener method with argument the name of the event. NOTE: This method still exists but it is deprecated. MeetHourExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods( removeListener).

api.removeEventListener("incomingMessage");

If you want to remove more than one event you can use removeEventListeners method with an Array with the names of the events as an argument. NOTE: This method still exists but it is deprecated. MeetHourExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods.

api.removeEventListeners(["incomingMessage", "outgoingMessageListener"]);

You can get the number of participants in the conference with the following API function:

const numberOfParticipants = api.getNumberOfParticipants();

You can get the avatar URL of a participant in the conference with the following API function:

const avatarURL = api.getAvatarURL(participantId);

You can get the display name of a participant in the conference with the following API function:

const displayName = api.getDisplayName(participantId);

You can get the email of a participant in the conference with the following API function:

const email = api.getEmail(participantId);

You can get the iframe HTML element where Meet Hour is loaded with the following API function:

const iframe = api.getIFrame();

You can check whether the audio is muted with the following API function:

api.isAudioMuted().then(muted => {
    ...
});

You can check whether the video is muted with the following API function:

api.isVideoMuted().then(muted => {
    ...
});

You can check whether the audio is available with the following API function:

api.isAudioAvailable().then(available => {
    ...
});

You can check whether the video is available with the following API function:

api.isVideoAvailable().then(available => {
    ...
});

You can invite new participants to the call with the following API function:

api.invite([ {...}, {...}, {...} ]).then(() => {
    // success
}).catch(() => {
    // failure
});

Continous integration

GitHub Actions

Tests are run whenever there is a commit, see .github/workflows/test.py for details.

Code coverage

Enable code coverage reporting to Codecov by creating a secret with name CODECOV_TOKEN in your repository settings (Settings -> Secrets -> New sectret) and value set to the token created by Codecov.