Jump to content

PLAYz emby for LG Smart TVs


simonjhogan
Go to solution Solved by ellnic,

Recommended Posts

kwilcox

I've not encountered this issue myself.  In fact playback was smooth when I used the hotspot on my phone to simulate a full internet WAN connection in preparation for giving the LG QA team access to my server.  Maybe you could try adjusting the video maximum bitrate to a lower number.

 

Maybe it has something to do with the video playback logic now using prefs to set initial audio/video bitrates.  In emby/.js search for "prefs." to find my changes.  You can set video playback bitrate to a constant again to see if this is it.  It used to be hardcoded there to 10000000.  Audio used to be hardcoded to 128000.

Link to comment
Share on other sites

mcgyver83

screenplay was submitted to LG for QA testing today.   :)

Screenplay?

 

I'm a bit confused: why running plex media server and emby together?The do the same things, or not?

Link to comment
Share on other sites

cmarques

Screenplay?

 

I'm a bit confused: why running plex media server and emby together?The do the same things, or not?

 
Screenplay is the name of our app, it's an unofficial emby app, so we can not use the official name in respect to emby team.
 
 
About the servers, yes, Plex and Emby does at least the same job, I don't know which comes first but I met Plex before and I became interested in it. After I met Emby and saw that somethings are a bit different, somethings are better other things not so.
 
Currently what counts in favor of Plex is that it has official and unofficial WebOS apps, and Emby has not till now.
The Emby theather app (web client) also do not works well on the webbrowser of WebOS 2.0, so it continues almost useless.
 
Finally, for me it's important to have Plex because it is fully funcional for my environment, even prefering Emby in overall comparing.
Link to comment
Share on other sites

cmarques

I've not encountered this issue myself.  In fact playback was smooth when I used the hotspot on my phone to simulate a full internet WAN connection in preparation for giving the LG QA team access to my server.  Maybe you could try adjusting the video maximum bitrate to a lower number.

 

Maybe it has something to do with the video playback logic now using prefs to set initial audio/video bitrates.  In emby/.js search for "prefs." to find my changes.  You can set video playback bitrate to a constant again to see if this is it.  It used to be hardcoded there to 10000000.  Audio used to be hardcoded to 128000.

Sorry, I could not test it last night. I was watching a movie with my daughter.
I watched using PlayPMS app, because of this problem... We watched a 1080p movie without any problems, and the server and TV was connected by wifi this time.
 
these bitrate that you comment is related to a 1080p movie?
Link to comment
Share on other sites

cmarques
hey @@kwilcox, I was investigating a bit more about this issue I'm suffering, so I went check the code you suggested.
See these two pieces of code, one is from Playz app and the other is from  Screenplay.
 
The codes has something similar, but what caught my attention was that lines about audioCodec, audioBitrate, videoCodec and videoBitrate.
 
what you think? Something is better implemented in the playz code? 

 

Playz (Plex)

 

// Transcoding

 
PLEX.prototype.getGenericTranscodeUrl = function(key, partKey, options) {
    options = options || {};
 
    var offset  = options.offset  || 0;
    var quality = options.quality || 7;
    var format = options.format || 'mpegts';
    var audioCodec = options.audioCodec || 'libfaac'; // AAC: libfaac, MP3: libmp3lame
    var audioBitrate = options.audioBitrate || 128;
    var videoCodec = options.videoCodec || 'libx264'; // H.264: libx264
    var videoBitrate = options.videoBitrate || 3000;
 
    var url = '/video/:/transcode/generic.'+format+'?';
    url += 'identifier='+encodeURIComponent('com.plexapp.plugins.library');
    url += '&format='+format;
    url += '&videoCodec='+videoCodec+'&videoBitrate='+videoBitrate;
    url += '&audioCodec='+audioCodec+'&audioBitrate='+audioBitrate;
    url += '&size=1280x720';
    url += '&width=1280&height=720';
    url += '&quality='+quality;
    url += '&fakeContentLength=2000000000';
    url += '&offset='+offset;
    url += '&key=' + encodeURIComponent('http://127.0.0.1:'+ this.getServerPort() + key);
    url += '&url=' + encodeURIComponent('http://127.0.0.1:'+ this.getServerPort() + partKey);
 
    return this.getServerUrl() + url;
};
 
PLEX.prototype.getHlsTranscodeUrl = function(key, options) {
options = options || {};
 
var path = "http://127.0.0.1:32400"+ key;
var session = localStorage.getItem(this.PLEX_SESSION_ID);
var mediaIndex = options.mediaIndex || "0";
var partIndex = options.partIndex || "0";
var protocol = options.protocol || "hls";
var offset = options.offset || "0";
var fastSeek = options.fastSeek || "1";
var directPlay = options.directPlay || "1";
var directStream = options.directStream || "1";
var videoQuality = options.videoQuality || "75";
var maxVideoBitrate = options.maxVideoBitrate || "3000";
var subtitleSize = options.subtitleSize || "90";
var audioBoost = options.audioBoost || "100";
var videoResolution = "1920x1080";
 
var url = "/video/:/transcode/universal/start.m3u8?";
url += "path=" + encodeURIComponent(path);
url += "&mediaIndex=" + mediaIndex;
url += "&partIndex=" + partIndex;
url += "&protocol=" + protocol;
url += "&offset=" + offset;
url += "&fastSeek=" + fastSeek;
url += "&directPlay=" + directPlay;
url += "&directStream=" + directStream;
url += "&videoQuality=" + videoQuality;
url += "&maxVideoBitrate=" + maxVideoBitrate;
url += "&subtitleSize=" + subtitleSize;
url += "&audioBoost=" + audioBoost;
url += "&videoResolution=" + videoResolution;
url += "&videoQuality=" + videoQuality;
url += "&session=" + session;
 
url += "&X-Plex-Client-Identifier=" + this.X_Plex_Client_Identifier;
url += "&X-Plex-Product=" + this.X_Plex_Product;
url += "&X-Plex-Device=" + this.X_Plex_Device;
url += "&X-Plex-Platform=" + this.X_Plex_Platform;
url += "&X-Plex-Platform-Version=" + this.X_Plex_Platform_Version;
url += "&X-Plex-Version=" + this.X_Plex_Version;
url += "&X-Plex-Device-Name=" + this.X_Plex_Device_Name;
 
return this.getServerUrl() + url;
};

 

Screenplay (emby)

 

EMBY.prototype.getVideoHlsStreamUrl = function(settings) {

settings = settings || {};
 
var itemId = settings.itemId;
var deviceId = settings.deviceId || this.settings.SessionInfo.DeviceId;
var videoCodec = settings.videoCodec || "h264";
var audioCodec = settings.audioCodec || "aac";
var audioStreamIndex = settings.audioStreamIndex || 1;
var videoBitrate = prefs.videoBitrate || 10000000;
var audioBitrate = prefs.audioBitrate || 128000;
var maxAudioChannels = settings.maxAudioChannels || 5;
var maxHeight = settings.maxHeight || 720;
var level = settings.level || 41;
var clientTime = settings.clientTime || "";
var profile = settings.profile || "high";
var playSessionId = settings.playSessionId || "1c7fddb7712646f9ba6352f8d9afc79e";
 
return this.settings.ServerUrl + "/videos/" + itemId + "/master.m3u8?deviceId=" + deviceId + "&mediaSourceId=" + itemId +
"&videoCodec=" + videoCodec + "&audioCodec=" + audioCodec + "&audioStreamIndex=" + audioStreamIndex + "&videoBitrate=" + videoBitrate + 
"&audioBitrate=" + audioBitrate + "&maxAudioChannels=" + maxAudioChannels + "&maxHeight=" + maxHeight + "&level=" + level +
"&clientTime=" + clientTime + "&profile=" + profile + "&playSessionId=" + playSessionId + "&api_key=" + this.settings.AccessToken;
};
 
EMBY.prototype.getImageUrl = function(settings) {
settings = settings || {};
 
var item = settings.itemId;
var tag = settings.tag;
var imageType = settings.imageType || "Primary";
var height = settings.height || "";
var width = settings.width || "";
var enableImageEnhancers = settings.enableImageEnhancers || true;
var quality = settings.quality || 90;
var percentPlayed = settings.percentPlayed || "";
var addPlayedIndicator = settings.addPlayedIndicator || false;
 
return this.settings.ServerUrl + "/items/" + item + "/images/" + imageType + "?height=" + height + "&width=" + width + "&tag=" + tag + "&enableImageEnhancers=" + enableImageEnhancers + "&quality=" + quality + "&percentPlayed=" + percentPlayed + "&addPlayedIndicator=" + addPlayedIndicator;
};

 

Link to comment
Share on other sites

kwilcox

The emby api and the plex api are different so equivalent values/features may not exist.  Did you try setting the video bitrate to a lower value to see if that helps? 

Link to comment
Share on other sites

kwilcox

The emby api and the plex api are different so equivalent values/features may not exist.  Did you try setting the video bitrate to a lower value to see if that helps? 

Link to comment
Share on other sites

I believe your TV runs the netcast OS. Unfortunately, this app only runs on LG TVs running WebOS.

Thank you for your reply. Dont have netcast version of emby media. ? :-(

Link to comment
Share on other sites

kwilcox

Here's an update on QA for this app.  According to my emby server logs, the LG team is already looking at screenplay.  They came in last night and tried out several features of the app.

Link to comment
Share on other sites

cmarques

this is really a bevy nice news!

 

and I need to reinstall the app again on my tv, so I can do another tests changing the bitrate values

Link to comment
Share on other sites

kwilcox

Interestingly, the bitrate setting doesn't seem to affect the playback of certain types of videos.  This has to be emby server not screenplay related.  In my case, all of my mkv encoded videos respond to bitrate setting changes while mp4 encoded videos do not.

 

I'm not sure why this is but I would expect it has to do with emby's ability to transcode certain compressed formats...

Edited by kwilcox
Link to comment
Share on other sites

cmarques

I have tested some adjusts but can't reach a point that please me. What I noted is that Plex playback is much more smooth than Emby and also sometimes Emby transcodes contents that plex does not.

Link to comment
Share on other sites

I have tested some adjusts but can't reach a point that please me. What I noted is that Plex playback is much more smooth than Emby and also sometimes Emby transcodes contents that plex does not.

 

Can you give specific examples of things you feel should not be transcoding, along with what app that is happening in? thanks.

Link to comment
Share on other sites

kwilcox

@@cmarques: I'm still interested in why this just started happening to you.  There are literally zero changes to the logic that would cause the 30 second pauses you cite.  In fact, adjusting the Video BitRate setting has allowed me to achieve smooth playback over an Internet connection using screenplay.  At home, I am now doubling the bitrate from screenplay's default settings to achieve noticeably higher quality playback on my 1080p content too.

 

If you aren't seeing variations, try pulling the latest repo.  I changed :

var videoBitrate = prefs.videoBitrate || 10000000;
var audioBitrate = prefs.audioBitrate || 128000;

to

var videoBitrate = Math.floor(prefs.videoBitrate) || 10000000;
var audioBitrate = Math.floor(prefs.audioBitrate) || 128000;
Edited by kwilcox
Link to comment
Share on other sites

mcgyver83

 

 
Screenplay is the name of our app, it's an unofficial emby app, so we can not use the official name in respect to emby team.
 
 
About the servers, yes, Plex and Emby does at least the same job, I don't know which comes first but I met Plex before and I became interested in it. After I met Emby and saw that somethings are a bit different, somethings are better other things not so.
 
Currently what counts in favor of Plex is that it has official and unofficial WebOS apps, and Emby has not till now.
The Emby theather app (web client) also do not works well on the webbrowser of WebOS 2.0, so it continues almost useless.
 
Finally, for me it's important to have Plex because it is fully funcional for my environment, even prefering Emby in overall comparing.

 

Ok, really cool!

I'm waiting the LG approval for Screenplay app  :)  :)

Link to comment
Share on other sites

Status update: LG rejected the app.  I have a few bugs to fix:

  • icon background can't be transparent - quick fix
  • one function incorrect on the self checklist - quick fix
  • the thumb image in Item play is incorrectly displayed - I kenw this but didn't think it would be an issue.  Will need to think about this one.  Should be pretty quick fix.
  • backspace button drops onscreen keyboard instead of back-spacing - odd since I don't trap backspace for any reason.  This could be problematic
  • Red key reset isn't documented - quick fix
  • back key doesn't exit movie and return to the home screen when a movie is playing - probably quick fix
  • forward/reverse skip isn't working properly for them - (this may be an issue related to the distance they are from my emby server so could be problematic to fix
Link to comment
Share on other sites

Update:

 

Working on the Resume feature but having an issue due to a emby api workaround I had to implement.  It appears that the emby api doesn't implement StartTimeTicks in GET /Videos/{Id}/master.m3u8 like the documentation shows.  I'm correctly setting that value but the movie always starts at the beginning.

 

Because of this, I have a workaround in place to set video.currentTime to the resume value when the video.playing event fires for the first time.  This works great unless the movie can be transcoded.  No skips appear to work well when this is the case.  Lots of delay occasionally and sometimes the movie doesn't resume.  This impacts skip, backskip, time positioning using the video controls slider, and resume as well. 

 

Also working on bugfix and not yet understanding why backspace on the on-screen keyboard exits in the settings screen only.  Everything else is coming along well...

Link to comment
Share on other sites

Wow!  I uncovered something awesome!  I can run this app in the chrome browser by double clicking on index.html, and it works perfectly!  Now, finally, I have full debugging capabilities using chrome's excellent developer tools.  Consequently, I've fixed the backspace issue (multiple event handlers on keydown) which also solved a workaround I had in place on the settings screen.  I'm running through the LG defect list now and should have the app resubmitted soon.

Link to comment
Share on other sites

cmarques

 

@@cmarques: I'm still interested in why this just started happening to you. There are literally zero changes to the logic that would cause the 30 second pauses you cite. In fact, adjusting the Video BitRate setting has allowed me to achieve smooth playback over an Internet connection using screenplay. At home, I am now doubling the bitrate from screenplay's default settings to achieve noticeably higher quality playback on my 1080p content too.

 

If you aren't seeing variations, try pulling the latest repo. I changed :

var videoBitrate = prefs.videoBitrate || 10000000;var audioBitrate = prefs.audioBitrate || 128000;
to
var videoBitrate = Math.floor(prefs.videoBitrate) || 10000000;var audioBitrate = Math.floor(prefs.audioBitrate) || 128000;
hi @@kwilcox, sorry for not reply you, I was on a business trip.

so, I know that my home environment isn't the best one, actually it is far of this. I have fully cable my network in order to improve the overall performance, it seems it works :-))

on TV side I have remove all apps and reinstall the latest one.

after that I have a truly smooth playback!!

 

about emby server transcoding contents that should not, I'm continues investigating, but the performance really goes up. the problem is that I have no ways to compare, since we have just the screenplay (as a webos app) to do tests.

 

and talking about emby, don't know when it start working on the web browser, but it is working now :-) partially, but at least now it works!

Link to comment
Share on other sites

cmarques

Wow!  I uncovered something awesome!  I can run this app in the chrome browser by double clicking on index.html, and it works perfectly!  Now, finally, I have full debugging capabilities using chrome's excellent developer tools.  Consequently, I've fixed the backspace issue (multiple event handlers on keydown) which also solved a workaround I had in place on the settings screen.  I'm running through the LG defect list now and should have the app resubmitted soon.

are you joking? :-)

I thought you knew that all the time, this was one of my first founds. how did you think I could achieve all my UI customizations? :-)

Link to comment
Share on other sites

lol... too bad you didn't share that discovery.  Origianlly, screenplay didn't work in a browser for me because I could never get past the original server/user login screens.  I assumed it had something to do with on-screen keyboard customizations native to LG; an assumption backed up by the considerable code devoted to what looked to be an on-screen keyboard handler.  It was only later that I understood the fact that this must have been legacy code from a playz-emby designed for Samsung TVs so I ripped a lot of the logic out.  Apparently the changes I made there fixed the browser issue as well.  My bad for never going back to test this until just now...

 

Of course what this also means is that you don't need developer mode to test screenplay.  Of course, you can't run it on your LG TV, but you can test out functionality on your personal computer.  Just clone the repo and doubleclick index.html.  I'd actually encourage people following this thread to d this because I'm really interested in getting the opinion of people who have large/varied emby libraries.  

 

How well does the indexed search feature work for you? 

Edited by kwilcox
Link to comment
Share on other sites

More on transcoding support as I continue to exploit the capabilities of Chrome debugging...

 

screenplay actually loads two video streams for each item selected.  One is a standard stream and the other uses the HTML Live Streaming spec (HLS).  HLS is interesting in that it doesn't appear to be a supported standard currently, so most browsers cannot choose the HLS stream for playback.  LG TVs do support HLS however.

 

From a screenplay perspective, some videos work with standard emby streaming ({emby server url}videos/{id}/stream.{type}) and bitrate settings don't affect them.  Converesly, others work with emby live streaming ({emby server url}/videos/{id}/master.m3u8).  Videos played using HLS respond to audio and video bitrate settings.

 

At this point, I'm not sure why some videos only work with standard streaming and others work only with HLS.  However, I can say this: its either one of the other.  I've not found a movie in my library that works with both yet.

 

relevant code is in player.js:

dom.append("#video", {
nodeName: "source",
src: emby.getVideoStreamUrl({
itemId: item.Id, 
extension: item.MediaSources[0].Container
}),
"type": mime.lookup(item.MediaSources[0].Container)
});
 
dom.append("#video", {
nodeName: "source",
src: emby.getVideoHlsStreamUrl({
itemId: item.Id
}),
"type": mime.lookup("m3u8")
}); 
Edited by kwilcox
Link to comment
Share on other sites

.....and the reason standard video streams don't respond to video/audio bitrate changes is that screenplay forces direct streaming (static = true) for these.  Why Simon did this is as follows:

 

When static is set to false, bitrate settings affect playback resolution as expected but, unfortunately, the HTML5 <video> attributes "duration" and "currentTime" aren't correctly returned by emby server.  I can work around the duration deficiency by using MediaSources[0].RunTimeTicks from {emby url}/users/{id}/items/{itemid}, but currentTime has me stuck currently.

 

So until I can find a suitable workaround for this api gotcha (ahem @@Luke for a hint plz :)), there won't be variable bitrates on some videos...

 

In other news, I've sorted the back button bug which leaves one more before I can re-submit to LG QA.... why pressing <ok> on the remote when a video is playing sends screenplay into la-la land remains a mystery to me at this point in time...

Edited by kwilcox
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...