Size of video container in receiver - google-cast

I know this is ridiculous, but I'm learning...
In a Chrome application I let my sender initiate and load a Custom receiver.
The receiver page includes a video element set to play one specific video, like this:
<video autoplay>
<source src="../media/someVideo.mp4" type="video/mp4">
</video>
The receiver page and the media file are hosted on a web server (SP)
I use no further communication between sender and receiver, so the receiver just loads and plays the video.
It works beautifully, but the video size on the device (TV) is too big. It fills the screen, but I don't see the full picture.
I try to downsize the video using CSS or by setting the width and height parameters on the video element, but the result is the same. Why doesn't ChromeCast respect these settings?

width/height for the video element should work. As a test, just set width and height in the element itself and test. On a tv screen, in general, there is a notion of overscan and most modern tv sets have a setting to adjust that, you might want to check to see if your tv offers that too or not.

Related

How does one play higher resolution videos (4k and higher) in VLC (desktop app and Unity)?

I'm trying to get a 360 streamed video to play at its full (4k) resolution. I did do previous searching and found the below thread but it didn't answer my question.
How do I adjust the video resolution?
My end goal is to integrate this into vlc unity but I also don't see how to adjust the resolution up to 4k (or higher) for streamed videos even on the desktop app. As a test, I tried a 4k video from youtube in the VLC desktop app and couldn't see how to get it to play in 4k. The end goal is to stream from aws but I want to confirm that my stream can indeed play at 4k before continuing to try to figure out why it's playing at lower resolution within Unity. It resizes down to 1920x1080 instead of the intended 4096x2048 for my aws stream and resizes the youtube video down to 1280x720 from its 3840x2160.
I've tried messing with the advanced settings and looking at input/codecs and the best option for "preferred video resolution" is "best available" (below that is full hd). I've looked through other suggestions online and didn't see a lot to change but did change Settings-->Video-->Output to "DirectX (DirectDraw) video output. This one was just me fumbling through the desktop app, but I tried going through Media-->Open Network Stream, clicking the arrow next to play and selecting stream, choosing RTSP for destination, and then editing the resolution within the profile to be a specified width and height. None of the above changed the resolution of the video.
TL;DR - How can I play a streamed video at higher resolutions (4k and up) in the VLC desktop app and in VLC Unity?
Edit - adding requested code snippets. This just modifies the UseRenderingPlugin file from the VLC unity asset.
Also, similar to what was getting discussed in the comments, when I play the video locally instead of streaming, it plays at the full resolution of the video.
Within Awake() I set the material to the 4096x2048 one mentioned for the skybox
RenderSettings.skybox = material4k;
And then in Update here is the relevant segment
var texptr = _mediaPlayer.GetTexture(out bool updated);
            if (updated && texptr != IntPtr.Zero)
            {
                Debug.Log("Creating texture ");
                tex = Texture2D.CreateExternalTexture((int)width,
                    (int)height,
                    TextureFormat.RGBA32,
                    false,
                    true,
                    texptr);
                RenderSettings.skybox.mainTexture = tex;
                }

Is dialog with background audio possible?

One of my goals with learning dialogFlow and programmatic webhooks to handle intens and responses is to see if it's possible to create an audio rich quiz.
In this quiz there's a section where I would like to have multiple questions/responses with a continuous audio background playing at the same time. Is this possible or must the Google Assistant or Google Home Speaker be silent when waiting for user input?
Also, if it is possible with the above, is it also possible to make crossfades between audio backgrounds triggered by events of some kind? That is like a change of scenery without interruption/silence.
There are a number of approaches to this, depending on your exact needs and limitations you have. Not everything is completely possible, but you may be able to get close.
Dialog with Background Audio
The easiest way to do this would be to use Google's version of SSML with parallel elements using the <par> and <media> tags. (But be aware that these are non-standard tags, if you want to be able to use them elsewhere.) With this, you would have one "track" for the dialog and one for the audio. It might look something like this:
<speak><par>
<media xml:id="track-0" begin="0s" soundLevel="+0dB">
<audio src="https://actions.google.com/sounds/v1/crowds/crowd_talking.ogg" >crowd talking</audio>
</media>
<media xml:id="track-1" begin="0.75s" soundLevel="+0dB">
<seq>
<media>
<speak><p>Well, hello there</p></speak>
</media>
<media begin="2.0s">
<speak><p>How are you?</p></speak>
</media>
</seq>
</media>
</par></speak>
Is there an easy way to design this?
You might want to check out the Nightingale Visual SSML Editor which has also been released as an open source project. It can help get you started, but tweak the SSML yourself.
What about cross-fades?
Sure! Just indicate that you're fading one track out, and fading another in, starting at some offset to the end of the other track.
<speak><par>
<media xml:id="track-0" begin="0s" fadeOutDur="6s">
<audio src="https://actions.google.com/sounds/v1/alarms/digital_watch_alarm_long.ogg" >digital watch alarm long</audio>
</media>
<media xml:id="track-1" begin="track-0.end-6s" fadeInDur="6s">
<audio src="https://actions.google.com/sounds/v1/human_sounds/baby_cry_long.ogg" >baby cry long</audio>
</media>
</par></speak>
And I can have this playing while the microphone is open and listening to a user?
Well... no. Not with SSML.
If you think about this as a conversation with someone, we typically require audio cues to know when to speak. Asking a question and then giving quiet space to reply is an excellent way to do this. In person - we have other cues (we can see the other person pause, for example), but if we just have audio, we only have silence.
The Assistant works based on this sort of conversational model, so wants to make it clear to the user when it is their turn to speak.
You can argue that for some kinds of "conversations", it is normal to have a different audio cue that prompts the user. And you'd be correct. But the Assistant needs to be a general-purpose Assistant.
Then how can I do this?
Since you're making a quiz, you can use the Interactive Canvas to create a page with HTML and JavaScript. With this, you can use an <audio> tag or the MediaStream JavaScript API to create the background audio. With this, you can have the microphone open while this media still plays, but there isn't any event that lets you know when the mic is open so you can duck the audio, which is a bit of a downside.
This gets around the audio-cue issues because there are visual cues when the microphone is open.
You can also use the SSML <mark> tag to trigger events in your JavaScript so you know when the SSML from the server begins, ends, or hits other points in the audio stream.
If there are visual cues, can I use the Interactive Canvas on a smart speaker?
Well... no.
But what you can do is use runtime surface capabilities to determine if the Interactive Canvas is supported.
If it is - use it (possibly along with SSML).
If not, use the SSML method.

medialement.js not working for my hls on iphone

Here is my m3u8 file:
cat 8.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:YES
#EXT-X-MEDIA-SEQUENCE:1131
#EXT-X-TARGETDURATION:5
#EXTINF:4.950, no desc
1545049888215.ts
#EXTINF:4.950, no desc
1545049893218.ts
I serve it at as static file at http://104.248.205.68:31339/8.m3u8
I use mediaelemnts.js to run this hls video: jsfiddle
html:
<video width="240" height="160"
id="player1" src="http://104.248.205.68:31339/8.m3u8"
controls="controls" autoplay preload="auto" muted ></video>
js:
$('video').mediaelementplayer({});
It works fine on chrome mac os desktop. But not working on iphone 8+ (safari and chrome). No errors in the console. Video just not played, black screen. In the fullscreen mode of video - the same.
At the same time, if I find a random m3u8 on the internet and use mediaelemnts.js to play it, it works well on the iPhone (at least in fullscreen mode) jsfiddle 2.
So I guess something wrong with my m3u8 file since other m3u8s are runnable on the iPhone.
If I open network tab while loading the problem page on Iphone, I see it's downloading the files but not showing video for some reason.
Update
I checked on android: galaxy s5 and galaxy s9+ in chrome: both works.
Update 2
Zip archive with ts files and m3u8: http://104.248.205.68:31339/8.m3u8.zip
When inspecting the media files [1] it can be found that the PMT (Program Map Table) signals that there is audio in the stream, but there are actually no TS packets for audio (i.e. no audio data) present.
It looks like the player waits for the audio TS packets in order to build a common buffer for both, audio and video, and only then start playback. Since the stream lacks audio data that never happens. To back that up, you can use ffmpeg to remove the audio track from the media segments using the below command and find that playback would work once you do this.
ffmpeg -i 1545049893218.ts -an -vcodec copy 1545049893218-v.ts
Further, the reason this problem only manifests in Safari and Chrome on iOS is that in those cases mediaelement.js is using the browser's native capabilities to play HLS, instead of a JavaScript player (like hls.js) which is used on other platforms (e.g. Chrome on desktop) and is more tolerant to such problem cases.
[1] E.g. using http://thumb.co.il/ or ffprobe
EDIT:
While the above may be sufficient to make it work on older Apple mobile devices - I tested on iPhone 6 iOS10 - newer devices seem to be more restrictive. The official HLS Authoring Spec states
8.11. You MUST provide at least 6 segments in a live/linear playlist.
which does not seem to be a hard requirement on some iOS versions. However, to ensure it to be working on all versions these requirements should be met.
I did a quick test on iPhone X with iOS12 and found it would play if at least 3 segments are provided in the playlist by just duplicating the last segment entry.

Embed audio to save bandwidth? To embed or stream?

<audio controls>
<source src="/audio/{$link_data.ID}.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
I have a mix of text like pages in a book, images and audio on my website. When you move from page to page a new mp3 is being loaded and sometimes images.
Sometimes people only read the text or play the audio or a mix of the two.
I was wondering what the best way is to have the audio available without it downloading (on each new page). By being available I mean that you would press the play button before it started to stream the audio.
Just set preload="none".
<audio controls preload="none">
The media will not begin downloading until requested by the user.
Reference:
http://www.w3.org/TR/html-markup/audio.html#audio.attrs.preload

HTML5 video on iOS5 not loading/showing

I have an HTML/JS app running in a webview in an iPad app. The app uses the HTML5 video tag. Videos work fine in iOS4.3 but today I've tested on iOS5 and the videos simply do not show up.
I have verified that it is not a layout related issue by setting background color and borders on the video element.
The same behaviour is evident irrespective of whether the app is run directly in mobile safari /from the home screen or within the webview.
The template for the video is simply:
<video controls src='{url}'></video> //where {url} is substituted at runtime.
The relevant video url plays correctly directly in the mobile Safari on iOS5.
I have tried to proxy the app comms and it seems that it does start loading the video but then stops, no video controls show and only the background color I have set shows thru.
Any ideas would be greatly appreciated. Thanks.
Have you tried create an empty webview, without additional parameters and scripts and make sure that you call it only once? I had the same issue when i call it twice without clearing previously created one - just audio was played.
Try to look at http://blog.millermedeiros.com/2011/03/html5-video-issues-on-the-ipad-and-how-to-solve-them/ and see if the fix works for you...
he he - should have read the fine print - did not notice you had answered yourself - remember to tick the thread off as answered
I've fixed this in code by changing the width and height by a pixel once the video element is created. Must invoke a repaint or something to that effect

Resources