hooray4me 52 Posted May 21, 2019 Share Posted May 21, 2019 (edited) Thanks @@chef! I will give it a try! So close! :/ I can get the series Id, then the season id's... but it appears that both the season id AND the episodes reference the same parent id.... the series Doc McStuffins is id 8554 If I apply an additional filter of &filters=Isfolder I can get the season ID's by themselves.... curl -H "Content-Type: application/json" -H "X-Emby-Token: xxxxxxxxxxxxxxxx" -X GET "http://tv.domain.com:8096/emby/Items?&Recursive=true&ParentId=8554&Filters=IsFolder" | jq -r '.' { "Items": [ { "Name": "Season 1", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8555", "PremiereDate": "2012-03-23T05:00:00.0000000+00:00", "ProductionYear": 2012, "IndexNumber": 1, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "7d3ed39b255093e57fc0d417c2915fc8" }, "BackdropImageTags": [] }, { "Name": "Season 2", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8556", "PremiereDate": "2013-09-06T05:00:00.0000000+00:00", "ProductionYear": 2013, "IndexNumber": 2, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "d0424f05530f064255bbe0d3ded1f2e6" }, "BackdropImageTags": [] }, { "Name": "Season 3", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8557", "PremiereDate": "2015-07-02T05:00:00.0000000+00:00", "ProductionYear": 2015, "IndexNumber": 3, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "5814dc3ed86dc5e91d16011a4affdbf5" }, "BackdropImageTags": [] }, { "Name": "Season 4", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8558", "PremiereDate": "2016-08-05T05:00:00.0000000+00:00", "ProductionYear": 2016, "IndexNumber": 4, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "9109fc0e624c52f1bdb7669d1cf55b15" }, "BackdropImageTags": [] }, { "Name": "Season 5", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "24749", "PremiereDate": "2018-10-27T05:00:00.0000000+00:00", "ProductionYear": 2018, "IndexNumber": 5, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": {}, "BackdropImageTags": [] } ], "TotalRecordCount": 5 } If I don't use that filter I get the seasons AND the episodes.... This doesn't work using the Season id for the parent id curl -H "Content-Type: application/json" -H "X-Emby-Token: xxxxxxxxxxxxxxxx" -X GET "http://tv.domain.com:8096/emby/Items?&Recursive=true&ParentId=8555" | jq -r '.' Any idea how I can filter by Type or reversing the logic to &Filters=IsNotFolder ? Edited May 21, 2019 by robrhedrick Link to comment Share on other sites More sharing options...
chef 3746 Posted May 21, 2019 Share Posted May 21, 2019 (edited) I think to get episodes, remove the "isFolder" filter all together, and only have the ParentId equal to the season Id. This should return episode info. I will have to test that to make sure, then I will get back to you Not sure if it should also be recursive. Edit: just read your issue... Sorry, it's returning season and episodes. I'll take a look. One minute. Edited May 21, 2019 by chef Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 21, 2019 Share Posted May 21, 2019 I think to get episodes, remove the "isFolder" filter all together, and only have the ParentId equal to the season Id. This should return episode info. I will have to test that to make sure, then I will get back to you Ive tested and it gives you the seasons first and then the episodes. curl -H "Content-Type: application/json" -H "X-Emby-Token: b7cee43a658b40ff8e40c2a6e3e7dd55" -X GET "http://tv.chucklehead.lol:8096/emby/Items?Limit=7&Recursive=true&ParentId=8554" | jq -r '.' { "Items": [ { "Name": "Season 1", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8555", "PremiereDate": "2012-03-23T05:00:00.0000000+00:00", "ProductionYear": 2012, "IndexNumber": 1, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "7d3ed39b255093e57fc0d417c2915fc8" }, "BackdropImageTags": [] }, { "Name": "Season 2", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8556", "PremiereDate": "2013-09-06T05:00:00.0000000+00:00", "ProductionYear": 2013, "IndexNumber": 2, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "d0424f05530f064255bbe0d3ded1f2e6" }, "BackdropImageTags": [] }, { "Name": "Season 3", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8557", "PremiereDate": "2015-07-02T05:00:00.0000000+00:00", "ProductionYear": 2015, "IndexNumber": 3, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "5814dc3ed86dc5e91d16011a4affdbf5" }, "BackdropImageTags": [] }, { "Name": "Season 4", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8558", "PremiereDate": "2016-08-05T05:00:00.0000000+00:00", "ProductionYear": 2016, "IndexNumber": 4, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": { "Primary": "9109fc0e624c52f1bdb7669d1cf55b15" }, "BackdropImageTags": [] }, { "Name": "Season 5", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "24749", "PremiereDate": "2018-10-27T05:00:00.0000000+00:00", "ProductionYear": 2018, "IndexNumber": 5, "IsFolder": true, "Type": "Season", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "ImageTags": {}, "BackdropImageTags": [] }, { "Name": "Knight Time, A Bad Case of the Pricklethorns, Out of the Box, Run Down Race Car", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8559", "HasSubtitles": true, "PremiereDate": "2012-03-23T05:00:00.0000000+00:00", "OfficialRating": "TV-Y", "CommunityRating": 7, "RunTimeTicks": 14464430080, "ProductionYear": 2012, "IndexNumber": 1, "IndexNumberEnd": 4, "ParentIndexNumber": 1, "IsFolder": false, "Type": "Episode", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeasonId": "8555", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "SeasonName": "Season 1", "ImageTags": { "Primary": "7c94e3e4ed1487ca682ada4afe3ab869" }, "BackdropImageTags": [], "MediaType": "Video" }, { "Name": "Tea Party Tantrum, Blast Off!", "ServerId": "20110db0df424cdb8a2346794f3ff566", "Id": "8560", "PremiereDate": "2012-03-26T05:00:00.0000000+00:00", "OfficialRating": "TV-Y", "CommunityRating": 7, "RunTimeTicks": 14470179840, "ProductionYear": 2012, "IndexNumber": 5, "IndexNumberEnd": 6, "ParentIndexNumber": 1, "IsFolder": false, "Type": "Episode", "ParentBackdropItemId": "8554", "ParentBackdropImageTags": [ "505c44dab78dff676b0170305f17090a" ], "SeriesName": "Doc McStuffins", "SeriesId": "8554", "SeasonId": "8555", "SeriesPrimaryImageTag": "007752a38b7fce79d9e525d23efe6ba9", "SeasonName": "Season 1", "ImageTags": { "Primary": "845b6e2e364e0cb26b6508ef74819c49" }, "BackdropImageTags": [], "MediaType": "Video" } ], "TotalRecordCount": 176 } Link to comment Share on other sites More sharing options...
chef 3746 Posted May 21, 2019 Share Posted May 21, 2019 I got it! 8554 is the series ID. Try using parent Id = 24749 And see if it returns episode data from season 5 Link to comment Share on other sites More sharing options...
chef 3746 Posted May 21, 2019 Share Posted May 21, 2019 Sorry, just checking to see what is happening Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 21, 2019 Share Posted May 21, 2019 That is so strange... I had tried 8555 earlier and it didn't seem to work... now it does. probably user error. Thanks! I got it! 8554 is the series ID.Try using parent Id = 24749And see if it returns episode data from season 5 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted May 21, 2019 Share Posted May 21, 2019 (edited) What does "LocationTypes=Episode" do? Or "Media types=Episode" Unfortunately the swagger doesn't like it when I test through my domain. It looks like I can't actually execute http commands fro a remote source. I'll have to check when I'm back on my server. Edited May 21, 2019 by chef Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 21, 2019 Share Posted May 21, 2019 Nothing lol... 1 Link to comment Share on other sites More sharing options...
PenkethBoy 2063 Posted May 21, 2019 Share Posted May 21, 2019 This works to just pull back episodes from a series using parentid (203336) ".../emby/Items?Recursive=true&ParentId=203336&IncludeItemTypes=episode&api_key=<key>" 2 Link to comment Share on other sites More sharing options...
PenkethBoy 2063 Posted May 21, 2019 Share Posted May 21, 2019 and you could add "&isMissing=false" so you only get genuine media entries 1 Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 (edited) What does "LocationTypes=Episode" do? Or "Media types=Episode" Unfortunately the swagger doesn't like it when I test through my domain. It looks like I can't actually execute http commands fro a remote source. I'll have to check when I'm back on my server. I've done it! I created a Rest Sensor that polls the emby api for series with the tag for kids and makes the 'state' of said sensor a comma delimited string of name and id... IE 'Doc McStuffins:8554,Some Show:1234' - platform: rest resource: http://tv.domain.com:8096/emby/Items?Recursive=true&IncludeItemTypes=Series&Tags=kids method: GET scan_interval: 1800 headers: Content-Type: 'application/json' X-Emby-Token: 'xxxxxxxxxxxxxxxxxxxxxxx' name: emby_kids_series value_template: > {% for item in value_json.Items -%} {{ item.Name }}:{{item.Id}}{% if not loop.last %},{% endif %} {%- endfor %} At system startup, after the Rest Sensor is populated, my automation calls back to the local Home Assistant API and updates the Menu Choices for TV Show with the name values from the Rest API. update_firetv_shows: url: "http://localhost:8123/api/services/input_select/set_options" method: POST headers: content-type: "application/json" Authorization: "Bearer xxxxxxxxxxxxxxxxxxxxxxxxx" payload: >- { "entity_id": [ "input_select.firetv_shows" ], "options": [ {% set temp =states.sensor.emby_kids_series.state.split(',') %} {%- for item in temp %} "{{item.split(':')[0]}}"{% if not loop.last %}, {% endif %} {%- endfor %} ] } At the set Trigger Time the automation kicks off by running an adb command to the firestick instructing it to launch emby (Emby is already set to automatically login as my daughters profile. - id: '155648556587' alias: call automations for olivia device at time initial_state: true trigger: - platform: template value_template: '{{ states.sensor.time.state == (states.input_datetime.liv_trigger_time.attributes.timestamp | int | timestamp_custom("%H:%M", False)) }}' action: - service: automation.trigger entity_id: automation.launch_emby_on_olivia_device - service: automation.trigger entity_id: automation.play_emby_show_on_olivia_device - service: automation.trigger data_template: entity_id: >- {% if is_state('input_select.firetv_media_select', 'TV Show') %} automation.play_emby_show_on_olivia_device2 {% else %} automation.play_emby_show_on_olivia_device {% endif %} - service: automation.trigger entity_id: automation.turn_olivias_tv_on - id: '15855573698' alias: launch emby on olivia device trigger: [] condition: - condition: state entity_id: automation.call_automations_for_olivia_device_at_time state: 'on' action: - service: script.adb_start_emby_on_device data_template: device: '{% if is_state(''input_select.firetv_device'',''Olivias Room'') %} media_player.olivias_room {% elif is_state(''input_select.firetv_device'',''Playroom'') %} media_player.play_room {% elif is_state(''input_select.firetv_device'',''Office'') %} media_player.bathroom {% else %} media_player.olivias_room {% endif %} ' adb_start_emby_on_device: sequence: - service: androidtv.adb_command data_template: entity_id: "{{device}}" command: "am start -n tv.emby.embyatv/.startup.StartupActivity" I have another sensor that polls the emby api and stores the value of the session id for the user. If TV Show is selected, The automation will pass The SeriesId, UserId, API Token and SessionId to a home assistant script, - id: '158575965865' alias: play emby show on olivia device2 trigger: [] condition: - condition: state entity_id: automation.call_automations_for_olivia_device_at_time state: 'on' - condition: state entity_id: input_select.firetv_media_select state: 'TV Show' action: - wait_template: "{{ not is_state('sensor.embysessionolivia', '') }}" - service: script.get_seasons_for_series data_template: show: '{% set temp =states.sensor.emby_kids_series.state.split('','') %} {%- for item in temp %} {% if states.input_select.firetv_shows.state == item.split('':'')[0] %} {{item.split('':'')[1]}} {% endif %} {%- endfor %}' token: xxxxxxxxxxxxxxxxxxxxxxxxxxxx userid: 81839facd92b4c86991c3088275a859b session: '{{ states.sensor.embysessionolivia.state }}' get_seasons_for_series: sequence: - service: shell_command.get_episodes_cmd data_template: show: '{{ show }}' token: '{{ token }}' userid: '{{ userid }}' session: '{{ session }}' Which then passes the variables to a shell_command... get_episodes_cmd: bash /home/rob/scripts/get_episodes.sh {{show}} {{token}} {{userid}} {{session}} The bash script pulls all the episodes in the series and puts the Id's into an array... then it randomly selects 10 Id's and concatenates then into a string like 'ItemIds=1234&ItemIds=5678'. This is passes this string into the emby api call to launch the playlist. seasons=$1 token=$2 userid=$3 session=$4 set -a arr for i in $(echo $seasons | sed "s/,/ /g") do arr+=( $(curl -H "Content-Type: application/json" -H "X-Emby-Token: $token" -X GET "http://tv.domain.com:8096/emby/Items?&Recursive=true&ParentId=$i" | jq -r '.[][]? | .Id') ) done result='' size=${#arr[@]} for ((i=1;i<=10;i++)); do index="$(($RANDOM % $size))" itm='ItemIds=' nd='&' rand="${arr[$index]}" result="$result$itm$rand$nd" done result=${result::-1} curl -X POST "http://tv.domain.com:8096/emby/Sessions/$session/Playing?$result&PlayCommand=PlayNow&api_key=$token" -H "accept: */*" \ -H "Content-Type: application/json" -d "{\"ControllingUserId\":\"$userid\",\"SubtitleStreamIndex\":0,\"AudioStreamIndex\":0,\"MediaSourceId\":\"string\",\"StartIndex\":0}" Piece of cake... lol Edited May 22, 2019 by robrhedrick 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted May 22, 2019 Share Posted May 22, 2019 (edited) That looks fantastic! Excellent job! Hey, Did you notice that you can also create a websocket for emby events in the API by using "ws://" instead of "http://". The only reason I mention it is because then you wouldn't have to poll for session data, the service could open the websocket and receive "Sessionstart", SessionEnd" and a bunch of playback events. Your programing skills are advanced, which is why I bring it up. Edited May 22, 2019 by chef Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 That looks fantastic! Excellent job! Hey, Did you notice that you can also create a websocket for emby events in the API by using "ws://" instead of "http://". The only reason I mention it is because then you wouldn't have to poll for session data, the service could open the websocket and receive "Sessionstart", SessionEnd" and a bunch of playback events. Your programing skills are advanced, which is why I bring it up. ooooo, just the rabbit hole I need for the afternoon lol Thanks, I'll check it out. Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 ooooo, just the rabbit hole I need for the afternoon lol Thanks, I'll check it out. The component that naively supports emby in Home Assistant appears to leverage a websocket connection. Might need to tweak some of the python code as a custom component to capture those events... https://github.com/mezz64/pyEmby/blob/master/pyemby/server.py https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/emby Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 ooooo, just the rabbit hole I need for the afternoon lol Thanks, I'll check it out. @@chef Are you sure that ItemId=1234&ItemId=5678 is the correct way to submit a 'playlist'? Once I call the service to launch the shows, the first one is indeed random, but the ones that follow are sequential.... Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 @@chef Are you sure that ItemId=1234&ItemId=5678 is the correct way to submit a 'playlist'? Once I call the service to launch the shows, the first one is indeed random, but the ones that follow are sequential.... I wonder if its ItemId=1234,5678 lemme try 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted May 22, 2019 Share Posted May 22, 2019 I'll check swagger one minute. Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 yep its comma delimited 1 Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 yep its comma delimited getting mixed results though on my my ItemIds... first couple are the correct series, then a random other show comes up.... Is it possible that an item can have a duplicate ItemId? Link to comment Share on other sites More sharing options...
hooray4me 52 Posted May 22, 2019 Share Posted May 22, 2019 This seems to work seasons=$1 token=$2 userid=$3 session=$4 set -a arr for i in $(echo $seasons | sed "s/,/ /g") do arr+=( $(curl -H "Content-Type: application/json" -H "X-Emby-Token: $token" -X GET "http://tv.domain.com:8096/emby/Items?&Recursive=true&ParentId=$i&IncludeItemTypes=episode" | jq -r '.[][]? | .Id') ) done result='' size=${#arr[@]} for ((i=1;i<=10;i++)); do index="$(($RANDOM % $size))" rand="${arr[$index]}" result="$result$rand," done result=${result::-1} curl -X POST "http://tv.domain.com:8096/emby/Sessions/$session/Playing?ItemIds=$result&PlayCommand=PlayNow&api_key=$token" -H "accept: */*" \ -H "Content-Type: application/json" -d "{\"ControllingUserId\":\"$userid\",\"SubtitleStreamIndex\":0,\"AudioStreamIndex\":0,\"MediaSourceId\":\"string\",\"StartIndex\":0}" Maybe my mixed result test from earlier was a fluke... seems more consistent now Link to comment Share on other sites More sharing options...
chef 3746 Posted May 22, 2019 Share Posted May 22, 2019 This seems to work seasons=$1 token=$2 userid=$3 session=$4 set -a arr for i in $(echo $seasons | sed "s/,/ /g") do arr+=( $(curl -H "Content-Type: application/json" -H "X-Emby-Token: $token" -X GET "http://tv.domain.com:8096/emby/Items?&Recursive=true&ParentId=$i&IncludeItemTypes=episode" | jq -r '.[][]? | .Id') ) done result='' size=${#arr[@]} for ((i=1;i<=10;i++)); do index="$(($RANDOM % $size))" rand="${arr[$index]}" result="$result$rand," done result=${result::-1} curl -X POST "http://tv.domain.com:8096/emby/Sessions/$session/Playing?ItemIds=$result&PlayCommand=PlayNow&api_key=$token" -H "accept: */*" \ -H "Content-Type: application/json" -d "{\"ControllingUserId\":\"$userid\",\"SubtitleStreamIndex\":0,\"AudioStreamIndex\":0,\"MediaSourceId\":\"string\",\"StartIndex\":0}" Maybe my mixed result test from earlier was a fluke... seems more consistent now I wonder if you used ItemId on the series level, and returned Include Item Types as episodes and used recursive, if you would get all the episodes of a series? Link to comment Share on other sites More sharing options...
chef 3746 Posted May 22, 2019 Share Posted May 22, 2019 I wonder if you used ItemId on the series level, and returned Include Item Types as episodes and used recursive, if you would get all the episodes of a series? It does. http://192.168.2.126:8096/emby/Items?Recursive=true&ParentId=13176&IncludeItemTypes=Episode&api_key=xxxxxxxxxxxxxxxxxxxxxxx Where parent ID is the SeriesId. It returns all the episodes and episode BaseItem data. Guess I should have known. I probably should have said something from the start... DOH! Link to comment Share on other sites More sharing options...
VicMoore 560 Posted February 27, 2021 Share Posted February 27, 2021 Good morning... I have a question... I have created a html file containing Javascript that browses the Emby library and allows me to select either a particular movie or TV show. I get the id for the media (and everything else associated with it) and would now like to play it (video or tvshow) in the same browser that's running the Javascript.. Is there an easy way to do this? Vic Link to comment Share on other sites More sharing options...
VicMoore 560 Posted February 28, 2021 Share Posted February 28, 2021 I think I need to add more detail to my previous post. I have created a javascript app that can browse the emby library and select a file to play. Below is an example of a selected movie. ====== Movie Clicked ======================================================= emby.html:366 key: Name, value: 4 for Texas emby.html:366 key: ServerId, value: 25cfcc1a8fd647f68bcb9a977e5d36aa emby.html:366 key: Id, value: 127 emby.html:366 key: Overview, value: Frank Sinatra plays a tough guy who hooks up with fellow rat packer Dean Martin to open a casino in this western. emby.html:366 key: RunTimeTicks, value: 69072620000 emby.html:366 key: IsFolder, value: false emby.html:366 key: Type, value: Movie emby.html:366 key: UserData, value: [object Object] emby.html:366 key: ImageTags, value: [object Object] emby.html:366 key: BackdropImageTags, value: aa3c443147002b669539219cd5a08f70 emby.html:366 key: MediaType, value: Video emby.html:367 ============================================================================= From this data I created the URL below by using the emby HLS API and the Id for the movie above. "emby.html:373 url = http://192.168.1.201:8096/emby/Videos/127/master.m3u8?api_key=2bac89852b194917b69b48a31d06f4c0" Next, I took this URL and applied it to an HTML5 video tag as the 'src' for that tag. I get a spinning circle, but the video never plays. I can play a local file but not a file from emby. Does anyone have an idea what I am doing wrong? The API worked flawlessly for creating the library browser. var url = emby_url+"Videos/"+Id+"/master.m3u8?api_key="+api_key; //var url = "Lamp.mp4"; console.log("url = "+url); var source = document.createElement('source'); // get an HTML source tag element source.setAttribute('src', url); // set the elements src attribute to the url source.setAttribute('type', "video/mp4"); // set the type attribute var vidNode = document.createElement("VIDEO"); // get an HTML video tag element vidNode.appendChild(source); // append the source element to the video element vidNode.id = "videoNode"; // set the video tag's id to videoNode vidNode.controls = true; // set the video tags controls switch vidNode.autoplay = true; // set the video tags autoplay switch $canvas.empty(); // empty the DOM's canvas element $canvas.append(vidNode); // add vidNode to the DOM vidNode.play(); // play the video Link to comment Share on other sites More sharing options...
chef 3746 Posted February 28, 2021 Share Posted February 28, 2021 hi @VicMoore have you checked out the swagger for emby urls? On the dashboard you can access the swagger by selecting the "API" link at the bottom of the page. you want to access "/Sessions" to begin playback if an item. let me know how it goes Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now