Jump to content

Progress Update


murxer83
Go to solution Solved by Luke,

Recommended Posts

murxer83

Hello, has anything changed in the progress submission?

Emby-Server-Version 4.7.14.0 OK

2024-03-25 14:00:55.949 Info Server: http/1.1 POST http://192.168.178.128:8096/Users/cf46abde1f76f9a4523/PlayingItems/3528423/Progress. UserAgent: python-requests/2.13.0
2024-03-25 14:00:56.285 Info Server: http/1.1 Response 204 to host2. Time: 336ms. http://192.168.178.128:8096/Users/cf46abae1f76f9a4523/PlayingItems/3528423/Progress

Emby-Server-Version Version 4.9.0.11 not Working

2024-03-25 15:27:37.787 Info Server: http/1.1 Response 400 to ‌‍‍192.168.8.168‌. Time: 1ms. POST http://‌‍‍192.163.999.5‌:11777/Users/b3cf35f738d2441f2/PlayingItems/1252611/Progress
2024-03-25 15:27:47.789 Info Server: http/1.1 POST http://‌‍‍192.163.999.5‌:11777/Users/b3cf35f7437745755638d2441f2/PlayingItems/1252611/Progress. UserAgent: python-requests/2.11.1
2024-03-25 15:27:47.790 Error Server: Error processing request
	*** Error Report ***
	Version: 4.9.0.11
	Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /var/packages/EmbyServer/var -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /var/packages/EmbyServer/var/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology72_{version}_x86_64.spk
	Operating system: Linux version 4.4.302+ (root@build5) (gcc version 12.2.0 (GCC) ) #69057 SMP Fri Jan 12 17:02:28 CST 2024
	Framework: .NET 8.0.0
	OS/Process: x64/x64
	Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll
	Processor count: 4
	Data path: /var/packages/EmbyServer/var
	Application path: /volume1/@appstore/EmbyServer/system
	System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'key')
	   at System.ThrowHelper.ThrowArgumentNullException(String name)
	   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
	   at Emby.Server.MediaEncoding.Api.PlaystateService.Post(ReportPlaybackProgress request)
	   at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: System.Collections.Concurrent
	TargetSite: Void ThrowArgumentNullException(System.String)

Or am I doing something wrong?

Thank you very much

 

Edited by murxer83
Link to comment
Share on other sites

Hi, do you use /PlaybackInfo prior to playback?

Link to comment
Share on other sites

murxer83

yes data from playbackinfo

 def getUpdateTimeline(self, item, transcoding, PositionTicks=None, IsPaused=False, index=0):
        if item["data"].get("PlaybackInfo"):
            params = {"MediaSourceId": item["data"]["PlaybackInfo"]["MediaSources"][index]["Id"],
                      "IsPaused": IsPaused,
                      "PlayMethod": "DirectStream" if not transcoding else "Transcode"}
            if PositionTicks is not None:
                params["PositionTicks"] = int((PositionTicks * 1000) * 10000)
            self.account.getUpdatePlayingItemProgressUser(item["data"]["Id"], params)

    def getUpdatePlayingItemProgressUser(self, Id, params=None):
        if params is None:
            params = {}
        print("[EmbyDream] get UpdatePlayingItemProgress")
        url = "{url}/Users/{UserId}/PlayingItems/{Id}/Progress".format(url=self.connector.url, UserId=self.connector.userid, Id=Id)
        data = self.connector.doPost(url=url, params=params, headers=self.connector.getHeader(), timeout=self.connector_timeout)
        status = handle_status_code(data)
        return status

 

Link to comment
Share on other sites

  • Solution

Excellent, so as part of the response you are given a PlaySessionId value. You should make sure this value is attached to all of your progress reports and stream urls (if you are building those manually).

Link to comment
Share on other sites

murxer83

Yes, I first query the playback info of the individual media and use the

It has always worked so far, but the users report that they have problems.

params["UserId"] = self.connector.userid
url = "{url}/Items/{Id}/PlaybackInfo".format(url=self.connector.url, Id=Id)
data = self.connector.doPost(url=url, params=params, headers=self.connector.getHeader(), timeout=self.connector_timeout)

 

Start Item

    def getSendPlayingItem(self, item, transcoding, index=0):
        if item["data"].get("PlaybackInfo"):
            params = {"MediaSourceId": item["data"]["PlaybackInfo"]["MediaSources"][index]["Id"],
                      "PlaySessionId": item["data"]["PlaybackInfo"]["PlaySessionId"],
                      "CanSeek": True,
                      "PlayMethod": "DirectStream" if not transcoding else "Transcode"}
            self.account.getSendPlayingItemUser(item["data"]["Id"], params)

    def getSendPlayingItemUser(self, Id, params=None):
        if params is None:
            params = {}
        print("[EmbyDream] Reports that a user has begun playing an item")
        url = "{url}/Users/{UserId}/PlayingItems/{Id}".format(url=self.connector.url, UserId=self.connector.userid, Id=Id)
        data = self.connector.doPost(url=url, params=params, headers=self.connector.getHeader(), timeout=self.connector_timeout)
        status = handle_status_code(data)
        return status

Here everything is still OK, I see that the user has started the stream. After a minute it shows me that the user has stopped the stream.

I transmit the progress every 10 sec. But it doesn't work on some servers. In my example above, where the request works, my own server is running here as well.

Link to comment
Share on other sites

murxer83
Posted (edited)

Found the problem, it was missing a parameter. Strange that it worked with my server but still.

Old
params = {"MediaSourceId": item["data"]["PlaybackInfo"]["MediaSources"][index]["Id"],
                      "IsPaused": IsPaused,
                      "PlayMethod": "DirectStream" if not transcoding else "Transcode"}
            if PositionTicks is not None:
                params["PositionTicks"] = int((PositionTicks * 1000) * 10000)

new
params = {"MediaSourceId": item["data"]["PlaybackInfo"]["MediaSources"][index]["Id"],
                      "PlaySessionId": item["data"]["PlaybackInfo"]["PlaySessionId"],
                      "IsPaused": IsPaused,
                      "PlayMethod": "DirectStream" if not transcoding else "Transcode"}
            if PositionTicks is not None:
                params["PositionTicks"] = int((PositionTicks * 1000) * 10000)

"PlaySessionId": item["data"]["PlaybackInfo"]["PlaySessionId"] --> was missing, now it works again as it should.

 

Thanks for the help

Edited by murxer83
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...