Skip to content

Latest commit

 

History

History
 
 

publish1080

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Publishing at 1080p

This example demonstrates a request for a MediaStream with video contraints to publish at 1080p.

Please refer to the Basic Publisher Documentation to learn more about the basic setup.

Example Code

These examples use the WebRTC-based Publisher implementation from the Red5 Pro HTML SDK. However, there is failover support to allow for Flash-base publisher on unsupported browsers.

MediaStream

Constraints for the audio and video components are defined when accessing a MediaStream from the browser.

To define a stream with 1080p constraints for publishing, request the MediaStream on getUserMedia and provide the stream to a Publisher instance:

var userMedia = {
  video: {
    width: {exact: 1920},
    height: {exact: 1080}
  }
};

function getUserMediaConfiguration () {
  return Object.assign({}, configuration.userMedia, userMedia);
}

 nav.getUserMedia(getUserMediaConfiguration(), function (media) {

     // Upon access of user media,
    // 1. Attach the stream to the publisher.
    // 2. Show the stream as preview in view instance.
    // 3. Associate publisher & view (optional).
    publisher.attachStream(media);
    view.preview(media, true);
    view.attachPublisher(publisher);

    targetPublisher = publisher;
    targetView = view;
    resolve();

  }, function(error) {
    onPublishFail('Error - ' + error);
    reject(error);
  });
[index.js #71](index.js#L71)

More information: Media.getUserMedia from MDN

Additional Information

To read more about Stream Quality and recommended settings, please visit The Balancing Act of Stream Quality on the Red5 Pro Blog.